views:

35

answers:

2

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);

 }
+1  A: 

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.

Alix Axel
A: 

I think I have solved the issue.

use 'fread' instead of 'fgets'

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

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

 print $contents;
JerA