0

我有这个 php 代码,它可以自动拇指并将我的照片排列到画廊:

<?php
$folder = "../albums/1000/";
$folder3 = "albums/1000/";
$handle = opendir($folder);
$noeffect = "noeffect";
while (false !== ($file = readdir($handle))) { 
                if (strpos($file, '.png',1)||strpos($file, '.jpg',1)||strpos($file, '.JPG',1) ) { 
$imgsrc= "../thumbnail.php?file=";
$imgend= "&width=120&height=120";
    echo ("
    <li><a href=\"".$folder.$file."\" rel=\"".$rel.external."\" class=\"".$noeffect."\">
 <img src=\"".$imgsrc.$folder3.$file.$imgend."\" /></a></li> "); }}
?>

它很好用,我喜欢它!但是当我上传 200-300 张图片时,它需要先加载拇指,然后才能在图库中查看大图。我在网上搜索并尝试了很多东西,但大多数都使用 mysql,我不知道如何处理它和其他有问题..有什么解决办法吗?谢谢!

例如,您可以在这里查看我在做什么:http: //m.eladhamemagnet.net/albums/996.php

顺便说一句,它适用于 iPhone,所以我需要它快速加载

4

1 回答 1

0

我找到了答案..我确实为任何照片预加载了..所以当缩略图加载时也是大图..

<?
$folder = "../albums/996/";
$folder3 = "albums/996/";
$handle = opendir($folder);
$noeffect = "noeffect";
while (false !== ($file = readdir($handle))) { 
                if (strpos($file, '.png',1)||strpos($file, '.jpg',1)||strpos($file, '.JPG',1) ) { 
$folder2 = ""; 
$imgsrc= "../thumbnail.php?file=";
$imgend= "&width=120&height=120";
    echo ("
    <li><a href=\"".$folder.$file."\" rel=\"".$rel.external."\" class=\"".$noeffect."\">
 <img src=\"".$imgsrc.$folder3.$file.$imgend."\" />
</a></li>

");
$pre = "../";
$jss = "text/javascript";
echo (" <script  type=\"".$jss."\">
if (document.images) {
    img1 = new Image();
    img1.src =\"".$folder.$file."\";
}
</script>");
  }
}
?> 
于 2011-09-20T03:34:31.027 回答