View Single Post
Old 06-02-2003, 05:04 PM   #1 (permalink)
Ilya020
Techno Rat
 
Ilya020's Avatar
 
Join Date: Jan 2003
Location: San Diego
Posts: 559
Ilya020 is on a distinguished road
Send a message via AIM to Ilya020
Question Script Not Working

Hello guys,

I have these two PHP scripts; gen.php and thumbs.php.
This is for an images gallary where gen.php produces the thumbnails and thumbs.php displays them.

I am trying to get this to work but the images keep getting broken. http://sig11.zemos.net/test/thumbs.php

here is the source for gen.php

Code:
<?php 

$t_width = 100; // Thumbnail width 

// get and display jpeg images 
if(stristr($QUERY_STRING,".jpg")){ 
header("Content-type: image/jpeg"); 
$srcimage = imagecreatefromjpeg($QUERY_STRING); 
$width = imageSX($srcimage); 
$height = imageSY($srcimage); 
$newh1= $height / $width; 
$newh2= $newh1 * $t_width; 
$destimage = imagecreate($t_width,$newh2); 
imagecopyresized($destimage,$srcimage,0,0,0,0,$t_width,$newh2,$width,$height); 
ImageJPEG($destimage); 
ImageDestroy($destimage); 
} 


// on a problem geneterate an image with ERROR in it 
/*else { 
$im = imagecreate(100,100); 
$blue = imagecolorallocate($im,0,0,200); 
$red = imagecolorallocate($im,255,0,0); 
imagestring($im,2,2,5,"ERROR",$red); 
imageGIF($im); 
imagedestroy($im); 
} */

?>
Here is thumbs.php

Code:
<?php 
// Set variables 
$default_dir = "./images"; // Relative to current location 


// Directory Scan 
if(!($dp = opendir($default_dir))) die("Cannot open $dir"); 
// Place images into image tag 
while($file = readdir($dp)){ 
    if($file != '.' && $file != '..' && stristr($file,"jpg")) echo "<a 
href=\"$default_dir/$file\"><img 
src=\"./gen.php?$default_dir/$file\"></a>\r\n"; 
} 

closedir($dp); 


?>
Any ideas?

Thank you

Ilya
__________________
> SELECT * FROM users WHERE clue > 0
0 rows returned
Ilya020 is offline   Reply With Quote