【发布时间】:2014-08-27 02:13:04
【问题描述】:
您好,我想创建一个图像库,在翻转后重新定位图像并调整其大小。我不确定我是否必须使用 javascript 或者只是 css 就足够了。我尝试了 jQuery,但我无法将每个 img 与翻转图像匹配。我还想如果我可以在 php 脚本中给每张图片不同的 id,那么之后我可以使用这些 id-s 来匹配 jquery 中的翻转图像。这是一张带解释的图片:
这个 php 脚本生成图库:
function showGallery()
{
$id = 0;
$size ='';
$galleryHTML = "<ul>";
$images = new DirectoryIterator("pildid");
foreach($images as $image) {
$file = $image -> current();
$filename = $file -> getFilename();
$src = "pildid/$filename";
$info = new Finfo( FILEINFO_MIME_TYPE );
$type = $info->file($src);
$galleryhtml = "";
if($type ==="image/jpeg" )
$galleryhtml ="<li><img src='$src' id='' height='100px' width='120px'/></li>";
echo $galleryhtml;
}
$galleryhtml = "</ul>";
include_once('view/galerii.php');
}
【问题讨论】:
-
请详细说明您的问题