|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Article Discussion: Resizing JPEG's With PHP and GD
If you have any questions or comments about this article then please post them here.
This forum post relates to this article |
|
#2
|
|||
|
|||
|
turning script on it's head...
Hi,
Thanks for writing this tutorial, it's really helped me loads ;-) What I'm trying to do is set a max width and height for the main pic (with ratio) and save that and then make a set width / height thumbnail without ratio. I've got it all working fine, except 1 thing. The quality of the images once they've been resized is awful, is there any way of making this better ??? // here's my code... PHP Code:
Thanks in advance, Jon |
|
#3
|
|||
|
|||
|
Jon,
If I'm reading your code correctly, you're trying to resize all your images to 700x500. The problem with this is that not all of your images will resize to that proportionally... What you need to do is calculate the best conversion scale (aspect ratio) to maintain the image quality: Code:
$scale = min(MAX_WIDTH/$width, MAX_HEIGHT/$height);
if ($scale < 1){
$new_width = floor($scale * $width);
$new_height = floor($scale * $height);
Once you receive your new width and height, you use those new values to resize your image... HTH!
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > Article Discussion: Resizing JPEG's With PHP and GD |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|