Thanks for fast answer.
Actually I do not care of the quality of a picture.
I want make easy adding product to the shop for my customer, for whom I make this shop. I want that he doesn't have to care of the size of image. He should just put any picture of a product to the AgoraCart's database and all of those pictures will be showed by Agora in the same sizes(I mean that just the height of all images must be the same, width must be in proportion to the original image)
I do not want to change the size of images which are stored by Agora!
I just need some script or something like this that it will take a image from database and will
show it on web site in different size.
I found some PHP script, but I don't know where to put it?
Code:
<?
function image_resize($image_file, $width, $height, $download)
{
$src = "jpg-resize.php?" .
"image_file=" . urlencode($image_file) . "&" .
"width=" . $width . "&" .
"height=" . $height;
$img = "<img " .
"border=\"0\" " .
"width=\"" . $width . "\" " .
"height=\"" . $height . "\" " .
"src=\"" . $src . "\" />";
if($download == true)
$img = "<a href=\"" . $image_file . "\">\n" .
$img . "</a>";
echo($img);
}
function image_horizontal_resize($image_file, $width, $download)
{
$original_size = getImageSize($image_file);
$original_width = $original_size[0];
$original_height = $original_size[1];
$height = round($original_height * ($width / $original_width));
image_resize($image_file, $width, $height, $download);
}
function image_vertical_resize($image_file, $height, $download)
{
$original_size = getImageSize($image_file);
$original_width = $original_size[0];
$original_height = $original_size[1];
$width = round($original_width * ($height / $original_height));
image_resize($image_file, $width, $height, $download);
}
if(isset($_GET))
{
header("Content-type: image/jpeg");
$image_file = $HTTP_GET_VARS["image_file"];
$width = $HTTP_GET_VARS["width"];
$height = $HTTP_GET_VARS["height"];
$original_size = getimagesize($image_file);
$original_width = $original_size[0];
$original_height = $original_size[1];
$original_jpg = imageCreateFromJPEG($image_file);
$resized_jpg = imageCreateTrueColor($width, $height);
imageCopyResized($resized_jpg, $original_jpg, 0, 0, 0, 0,
$width, $height, $original_width, $original_height);
imageJPEG($resized_jpg);
imageDestroy($resized_jpg);
}
?>
Do you think I am on good way?