Forum Moderators: coopster

Message Too Old, No Replies

php resize remote image

php resize remote image

         

gonny

10:44 pm on Mar 29, 2009 (gmt 0)

10+ Year Member



Hi all!
I'm looking for a code to re-dimension remote image without downloading into lokal folder. To give a new proporcional size of image only.

brotherhood of LAN

10:47 pm on Mar 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is it on a linux server? They tend to have imagemagick available.

I can think of 2 easy ways.

1) Use PHP's SSH functions, login using SSH and resize the image using imagemagick or PHP (or whatever else is available and capable)

2) Have the resizing script available via HTTP, perhaps behind a login, so you can just call that URL to execute the resizing

gonny

3:56 pm on Mar 30, 2009 (gmt 0)

10+ Year Member



yes is a linux server.
Can give me an example?

brotherhood of LAN

4:28 pm on Mar 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not really :)

Breakdown the various steps of the process

1) Knowing what images to resize
2) The logging on/authenticating
3) The image resizing
4) Error checking/feedback

You could easily split the authentication and image resizing processes into functions... both of which should be easy to Google for as there's a number of examples of each.

idfer

7:08 pm on Mar 30, 2009 (gmt 0)

10+ Year Member



You can do this rather easily with imagecopyresampled() [php.net]. The man page has pretty good examples to get you started, just make sure the destination file and directory are writeable by the web server.