Neil
Neil

Reputation: 95

Can I download a resized image?

I have a cron process that gathers information about movies and presents finished information to the user. Periodically, however, the link provided by the API to the "movie poster" is massive, and it's crashing the process with memory issues.

As an example - this file http://content8.flixster.com/movie/11/16/86/11168662_ori.jpg is huge. I believe it's around 17MB, and the image itself clocks in at 8175px x 12075px.

The maximum size my end users will see is around 360px wide. So downloading such a massive image is kind of ridiculous. And the next size down is 180 x 266 - I'm worried that it might not look right if I scale it up.

Is there a way that PHP will allow me to download a resized version? I know that if I download the file, I can do a million things to it. I'm trying to change the size of the download itself.

If not - any other solutions anyone can think of?

Upvotes: 0

Views: 113

Answers (2)

Murtuza Kabul
Murtuza Kabul

Reputation: 6514

Unfortunately there is no way and there cannot be a way logically. However there is a workaround. You can take help of some online utility to do the job

e.g. http://quickthumbnail.com which generates the thumbnail from given url

Hope this works for you.

Upvotes: 2

deceze
deceze

Reputation: 522135

This has nothing to do with PHP. Some remote service offers a file. You can take it or leave it. If they don't offer some API to downloaded a different size or different version of the file, you can't get it.

All you can do is download the file to your server, resize it there and offer it to your users.

Upvotes: 0

Related Questions