Page 1 of 1

Resize Image via hooks?

Posted: Sun May 20, 2012 3:34 am
by FrederickGeek8
Hello! I have not been here in a while because I have been busy off making my PHP skills all the more better! Anyways I came here today looking for something...

Does anyone know of a way that I can have a directory of images and when a user type in a url like
image.jpg?width=250&height=250
Then it would output the image with the dimensions 250px by 250px. If the user just typed in
image.jpg
then it would output the original sized image.

Does anyone know how to do this?

Re: Resize Image via hooks?

Posted: Sun May 20, 2012 1:37 pm
by jacek
Having
image.php?file=image.jpg&width=250&height=250
would be easier.

Then you could define
$width = (isset($_GET['width']) && $_GET['width'] > 0) ? $_GET['width'] : 250;
$height = (isset($_GET['height']) && $_GET['height'] > 0) ? $_GET['height'] : 250;
and use those as I did in the image gallery tutorial.