Image resize


Posted on 16th Feb 2014 07:03 pm by admin

Hi again fellers

I managed to sort out the issues with the folder,

Final hurdle is this:

Code: function ResizeJPEG($filename, $width, $height){
list($width_orig, $height_orig) = getimagesize($filename);

$ratio_orig = $width_orig/$height_orig;

if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
}

$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename); //JPEG
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
return imagejpeg($image_p, $filename, 100); //JPEG
}
Code: ResizeJPEG($target, 500, 500);
If i upload a file that is larger than 500 x 500 then sure that resizes it down too 500

But if i upload a file that is smaller than 500 x 500 then it upsizes the image too 500

How can i leave images smaller than 500 alone?

No comments posted yet

Your Answer:

Login to answer
173 Like 13 Dislike
Previous forums Next forums
Other forums

SAP Project Module
I have seen in the SAP Project Module,plan cost and budget are not equal and even difference is sign

Help with usergroups? prolly really quick
So were coding our own forums for a game system we made an we have the users level setup but now I n

Best way to check for end of a record and send it back to the first record
I'm hoping someone can help me out and explain the best way to accomplish this.

What I'm doin

getting weird error..
okay, I'm getting an error on this particular function, something about the syntax in the mysql LIMI

Session is not saving
I am not trying to do anything too fancy, I am just trying to get some $_SESSION data to save and us

Generate PDF
Hi guys,

I would like to know if there is a way to generate pdf when clicking on a link. In f

Creating a custom API
I'm creating a site, and I need to create a basic API. Unfortunately I have no idea where to start.

Any meaningful project for a new C++ programmer?
I want to do some meaningful program, so I can help myself to learn

Assume I know the fol

'grab_files', multiple extension?
hey guys,

can anyone suggest a way to make to following line of code look for files with more

SQL Injection
In my attempts to protect my database from mySQL injection I have created another problem for myself

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash