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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to