Re: Images On-Fly

From: Date: Wed, 03 Dec 2003 11:26:26 +0000
Subject: Re: Images On-Fly
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-171659@lists.php.net to get a copy of this message
My entire page will then not work. Apperently it contains then error. If i do delete that part of the php code it works just fine. "Dejan Dujak" <dejan.dujak@corusgroup.com> wrote in message news:20031203094234.82936.qmail@pb1.pair.com... > Hallo People, > > > > I have one problem with creating images on-fly. > > Therefore I created 2 files: > > 1. resize_image.php with the following > > <?php > > if (!$max_width) > > $max_width = 150; > > if (!$max_height) > > $max_height = 100; > > $size = GetImageSize($image); > > $width = $size[0]; > > $height = $size[1]; > > $x_ratio = $max_width / $width; > > $y_ratio = $max_height / $height; > > if ( ($width <= $max_width) && ($height <= $max_height) ) { > > $tn_width = $width; > > $tn_height = $height; > > } > > else if (($x_ratio * $height) < $max_height) { > > $tn_height = ceil($x_ratio * $height); > > $tn_width = $max_width; > > } > > else { > > $tn_width = ceil($y_ratio * $width); > > $tn_height = $max_height; > > } > > $src = ImageCreateFromJpeg($image); > > $dst = ImageCreate($tn_width,$tn_height); > > ImageCopyResized($dst, $src, 0, 0, 0, 0, > > $tn_width,$tn_height,$width,$height); > > header("Content-type: image/jpeg"); > > ImageJpeg($dst, null, -1); > > ImageDestroy($src); > > ImageDestroy($dst); > > ?> > > AND > > 2. filex.php .In that file i read from database where the image is stored en > > then i show small images(thumbnails). > > thet part of the code is : > > <?php do { ?> > > <tr> > > <td width="156" height="32" valign="top"><?php echo > > $row_rsSubGroup['name']; ?></td> > > <td colspan="2" valign="top"><?php > > $fotolink="../dbtest/".$row_rsSubGroup['image_1']); > > echo "<IMG > > SRC=\"resize_image.php?image=$fotolink\">"; > > ?> > > </td> > > </tr> > > <?php } while ($row_rsSubGroup = mysql_fetch_assoc($rsSubGroup)); ?> > > > > > > This doesn't WORK. Please HELP.

« previous php.general (#171659) next »