This topic is locked

image quality problem

2/18/2007 3:09:03 PM
PHPRunner General questions
B
bright author

I use fixed width and height (w= 390 x h= 293) for the images on the listing page.

I also use fixed width and height (w= 468 x h= 351) for the images on the view page.
So, when I upload the original images with a different dimension than is mentioned above, the dimensions of the images on the listing and the view page will be made in accordance with the above mentioned dimensions.
The problem is that the displayed image quality on the listing and the view page decreases to an unacceptable level.

I was wondering if there's a way to display the image on the listing and the view page with the same quality as its original image; how can I display images on the listing & view page without sacrificing the quality of the original image ?
Thx.

M
mmponline 2/18/2007

I only set either height or either with. Not both. This way I get constant witdh, but images takes on original height. No quality loss.
Hope this helps!

Alexey admin 2/19/2007

Hi,
when you decrease image size its quality decreases too.

There is nothing you can do with this.
I recommend you using thumbnailsto have both decreased and original images at the site.

B
bright author 2/19/2007

Hi Stephan,
Thx for your response. I fixed only the width, it didn't work, still the same poor quality.
Best regards,
Bul

B
bright author 2/19/2007

Hi Alexey,
I think image resizing will work in this case, image resizing takes care of image resizing without having quality loss.
I have the following image resizing code:
_
if(!$bad_file_flag)

{
// define new width, and height will be calculated by itself

$new_width = 450;
// filename will just be the current UNIX timestamp...

$fname = time() . $i;
//

move_uploaded_file($_FILES[$element_name][tmp_name],$vehicle_image_dir

.. "/$fname$file_extension");

// chmod($vehicle_image_dir . "/$fname$file_extension", 0666);

$tmp_image =imagecreatefromjpeg($_FILES[$element_name]['tmp_name']);

$width = imagesx($tmp_image);

$height = imagesy($tmp_image);
$new_height = round(($height / 100) (100 / $width $new_width),

0);
$new_image = imagecreatetruecolor($new_width, $new_height);

ImageCopyResized($new_image, $tmp_image,0,0,0,0, $new_width,

$new_height, $width, $height);

ImageJPEG($new_image,$vehicle_image_dir ."/$fname$file_extension");

ImageDestroy($tmp_image);

ImageDestroy($new_image);
// move_uploaded_file($image_buffer, $vehicle_image_dir

.."/resized$fname$file_extension");

chmod($vehicle_image_dir . "/$fname$file_extension", 0666);
mysql_query("INSERT INTO dah_images (filename,

vehicle_id)VALUES('$fname$file_extension', $insert_id)");

}

else

{

// remove the bad file - we don't know what this is!

@unlink($_FILES[$element_name][tmpname]);

};

Could you pls help me with implementing this code into the PHPRunner code ?
Thanks !
Best regards,
Bul

Alexey admin 2/19/2007

Bul,

I think image resizing will work in this case, image resizing takes care of image resizing without having quality loss.



I'm afraid you are wrong.
I still recommend you using Thumbnailsfeature.

It performs resizing the same way as your code does.

B
bright author 2/20/2007

Hi Alexey,
Thank you for your reply.
Suppose I have already a few hundred images in an existing database.

How can I display images on the listing & view page without sacrificing the quality of the original images

(and without re-uploading all the images again) ?
Thx.
Best regards,
Bul

Alexey admin 2/20/2007

Bul,
looks like we are talking about different things.
Please give me an example of a resized image with and without quality loss.

Give me URL or send screenshots to support@xlinesoft.com

B
bright author 2/22/2007
B
bright author 2/25/2007

Hi Alexey,
Thank you very much for your kind response !
The quality that the PHP resize code provides is sufficient.

You are the expert, could you please help me with implementing the PHP resize code into the PHPRunner code (assuming an existing database) ?
Thanking you very very much !
Best regards,
Bul

B
bright author 2/28/2007

Hi Alexey,

Thank you very much for your kind response !
The quality that the PHP resize code provides is sufficient.

You are the expert, could you please help me with implementing the PHP resize code into the PHPRunner code (assuming an existing database) ?
Thanking you very very much !
Best regards,
Bul


Hello Alexey,
Would you please help me ???
Many many thanks.
Regards.
Bul

Alexey admin 3/1/2007

Bul,
there is no need in additional code here.

To resize newly uploaded images use thumbnails.

To resize existing images use some specialized software i.e. ACDSee.