在滚动或单击按钮时加载更多图像(没有 mysql)

发布于 2024-12-05 08:06:53 字数 911 浏览 2 评论 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,所以这就是为什么我需要它快速加载

i have this php code who auto thumb and arrange my photos to gallery:

<?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> "); }}
?>

it works great and i love it! but when i upload 200-300 pictures it need to load the thumbs before it could view the big picture in the gallery..
i search the net and tried many things but most of them use mysql and i dont know how to deal it and others were problematic.. any solution? thanks!

You can take a look here for example for what im doing : http://m.eladhamemagnet.net/albums/996.php

btw its for iphone so thats why i need it to load fast

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

望她远 2024-12-12 08:06:53

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

<?
$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>");
  }
}
?> 

I found the answer.. i did preload for any photo.. so when the thumbnail is loaded also the big picture..

<?
$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>");
  }
}
?> 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文