Resize Image via hooks?

Ask about a PHP problem here.
Post Reply
User avatar
FrederickGeek8
Posts: 148
Joined: Wed Nov 30, 2011 10:31 pm

Resize Image via hooks?

Post 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?
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Resize Image via hooks?

Post 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.
Image
Post Reply