This is a discussion on Images On-Fly within the PHP General forums, part of the PHP Programming Forums category; Hallo People, I have one problem with creating images on-fly. Therefore I created 2 files: 1. resize_image.php with ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
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. |
|
|||
|
On Wednesday 03 December 2003 19:26, Dejan Dujak wrote:
> 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. So turn on FULL error reporting and find out what the error is. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Whistler's mother is off her rocker. */ |