php 不显示所有图像
我正在用 php 编写一个画廊应用程序。图像通过php动态显示。 每次加载页面时,并非所有图像都会显示。它在每次加载时随机执行此操作。
我以前没有遇到过这个问题,因为我是 php 新手。我以前的应用程序都是用 Perl 编写的,使用该语言时没有出现动态图像显示问题。
在这里检查: http: //dev.system-engine.com/dev/exec/pcli.php?R=%27/Paintings%27&cfg=%22fgal%22
感谢所有帮助。
谢谢,
Jer A
这是一些代码:
function imageThumbLoad($ref) {
$path = FOTOGAL_PORT::$ROOT.$ref;
$path=preg_replace("/\'/","",$path);
$path=preg_replace("/\"/","",$path);
$path=preg_replace("/\*/"," ",$path);
$path=preg_replace("/\^/","&",$path);
$path=preg_replace("/\/([^\/]*)\/\.\./","",$path);
if(preg_match_all("/\.jpg|\.jpeg/",$path,$tmpmatches))
{
header("Content-type: image/jpeg");
$fh = fopen($path, 'r');
while (!feof($fh)) {
$l= fgets($fh, 4096);
print $l;
}
fclose($fh);
}
I a writing a gallery app in php. The images are dynamically displayed through php.
On each load of the page, not all images are showing. it does this randomly, on each load.
I have not had this problem before, as I am new to php. My previous apps where all in perl, and I had no dynamic image display problems when using that language.
check it here:
http://dev.system-engine.com/dev/exec/pcli.php?R=%27/Paintings%27&cfg=%22fgal%22
all help appreciated.
thank,
Jer A
here is some of the code:
function imageThumbLoad($ref) {
$path = FOTOGAL_PORT::$ROOT.$ref;
$path=preg_replace("/\'/","",$path);
$path=preg_replace("/\"/","",$path);
$path=preg_replace("/\*/"," ",$path);
$path=preg_replace("/\^/","&",$path);
$path=preg_replace("/\/([^\/]*)\/\.\./","",$path);
if(preg_match_all("/\.jpg|\.jpeg/",$path,$tmpmatches))
{
header("Content-type: image/jpeg");
$fh = fopen($path, 'r');
while (!feof($fh)) {
$l= fgets($fh, 4096);
print $l;
}
fclose($fh);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一切都显示得很好,在浏览器中点击 CTRL + F5。
如果这不能解决问题,请尝试重新启动您的网络服务器或检查配置指令。
Everything shows up just fine here, hit CTRL + F5 in your browser.
If that doesn't solve try restarting your web server or checking the configuration directives.
我想我已经解决了这个问题。
使用“fread”代替“fgets”
I think I have solved the issue.
use 'fread' instead of 'fgets'