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

PHP hyperlinks generator
Hi

I need some help to get this done using php:


1 - I have few hyperlinks say 500

Problem with creating FI documents
Hi, Experts!

when i create Fi doc. with standart transaction, i ve been had such problem

FAGL_FC_TRANSLATION FAS52 New GL ECC 6.0
Hello,

The new program for Translating GL Balances (FAS 52) gives the option to use diffe

BB_Code error
I'm having a problem with a custom built function and keep getting this error:


Warning: M

New Login Script
Hi all, i attempted to create a whole new login script witch isnt working for some reason i dont kno

Program with calculate Meteorologic measurements
Hello I'm a beginner and I want to make a program with calculate Meteorologic measurements:
ba

Time script, set to my time zone?
I am using this line to get the date and time

Code: $time = date(F." ".d.", &q

Variable Clash
In the past I've had variables clash. For example:

Code: <?php
$c = 5;
$ca

How many users online in the last 24-hours using time()?
I'm fairly new to PHP. I have a MySQL table called 'users' and a field called 'loggedin' which is in

how do i display data on a page from mysql
1 - do i use this code at the top of each of my page i wish to only alow access if there as been a s

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