这是在前端图库中显示图像的当前代码。
我需要的是一个链接或按钮,用于在按下时删除单个图像。 它应该在删除然后删除之前显示确认javascript警报 不需要ajax只是简单的javascript页面刷新是没有问题的。
我已经浏览了互联网,但无法找到一个好的解决方案。
function Closify_Translate_Images_to_Photoswipe_HTML($galleries, $effect,
$random_id, $itemPerPage = 10, $disable_caption = "off", $imgWidth = '',
$titleEnabled = 'off', $isMultiPage)
{
// Update caption flag
$caption = ($disable_caption!="on")?true:false;
$itemWidth = '';
// Update title flag
$title = ($titleEnabled!="on")?true:false;
// Update item's width
if($imgWidth != '') $itemWidth = ';width:'.$imgWidth.'px;';
// Update option range
$options = '';
for($i=10;$i<35;$i=$i+5)
{
if($i==$itemPerPage){
$options = $options . '<option selected>'.$i.'</option>';
}else{
$options = $options . '<option>'.$i.'</option>';
}
}
$numPages = '';
if($isMultiPage){
$itemWidth = $itemWidth.'opacity:0;';
$numPages = '<form class="closify-jpages-form">
<label>items per page: </label>
<select id="closify-select-'.$random_id.'">
'.$options.'
</select>
</form>';
}
$holder = '<div class="closify-holder closify-holder-'.$random_id.'">
</div>';
$htmlStart = '<div id="itemContainer-'.$random_id.'" class="closify-gallery"
itemscope itemtype="http://schema.org/ImageGallery">';
$htmlEnd = '</div>';
$htmlBody = '';
$titleText = "";
$captionText = "";
$titleCopyright = "";
foreach($galleries as $gallery)
{
if($caption && $gallery['img_desc']!='')
$captionText = '<br>Description <small>'.$gallery['img_desc'].'</small>';
else
$captionText = "";
if($title)
$titleText = 'Title <small>'.$gallery['img_title'].'</small>';
$htmlBody = $htmlBody.'<figure class="closify-figure-gallery-item" style="'.$itemWidth.'" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<a href="'.$gallery['full'][0].'" itemprop="contentUrl" data-size="'.$gallery['full'][1].'x'.$gallery['full'][2].'">
<img class="closify-animated '.$effect.'" src="'.$gallery['thumb'][0].'" itemprop="thumbnail" alt="'.$gallery['img_alt'].'" />
</a>
<figcaption itemprop="caption description">'.$titleText.$captionText.'</figcaption>
</figure>';
}
return $numPages.$holder.$htmlStart.$htmlBody.$htmlEnd;
}
答案 0 :(得分:0)
从服务器端,只有一个PHP文件应该处理从客户端上传的图像,并且这个单个处理文件由&#34; processupload.php&#34;表示。文件。此文件负责生成正确的照片/缩略图,其中使用AJAX将调整大小的照片发送回客户端,以便无缝地向用户显示。
############ Put your custom code here ##############
This means that you can harness this space to add your own logic.
Other specific places to look:
1.
/****************************************************/
/****************************************************/
/*
// Insert info into database table!
mysql_query("INSERT INTO myImageTable (ImageName, ThumbName, ImgPath)
VALUES ($DestRandImageName, $thumb_DestRandImageName, 'uploads/')");
/****************************************************/
/****************************************************/
2.
// Handling position save command
if(isset($_POST["top"]) || isset($_POST["left"]))
{
// When somebody saves a picture you can read "top" and "left" and save them, so it become stored
// play with "left / top" image position
echo "Success";
}
// Handling image delete command
// POST
// command: delete
// id: The ID name of the specific image container that has been deleted
if(isset($_POST["command"]) && isset($_POST["id"]))
{
// When somebody delete a picture, the corresponding action should be put here
echo "Deleted";
}