简体   繁体   English

PHP不显示所有图像

[英]php not showing all images

I a writing a gallery app in php. 我用php编写图库应用。 The images are dynamically displayed through php. 图像通过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. 我以前没有这个问题,因为我是php新手。 My previous apps where all in perl, and I had no dynamic image display problems when using that language. 我以前的应用程序全部使用perl编写,并且使用该语言时没有动态图像显示问题。

check it here: http://dev.system-engine.com/dev/exec/pcli.php?R=%27/Paintings%27&cfg=%22fgal%22 在此处检查: 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);

 }

Everything shows up just fine here, hit CTRL + F5 in your browser. 一切正常显示在这里,在浏览器中按CTRL + F5

If that doesn't solve try restarting your web server or checking the configuration directives. 如果仍不能解决问题,请尝试重新启动Web服务器或检查配置指令。

I think I have solved the issue. 我想我已经解决了这个问题。

use 'fread' instead of 'fgets' 使用“ fread”而不是“ fgets”

 $fh = fopen($path, 'r');

 $contents = fread($fh, filesize($path));

 print $contents;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM