I’m building an auction website (in Python/Django). Users can provide URL’s to their product images stored in external sites, for example images stored in Photobucket.
So my plan is that when displaying a specific auction, I’ll link to the external product image. But when I’m showing list of auctions (e.g. a search results page) I’d need to show the thumbnails
I can see 2 options of doing this:
-
Use the externally hosted images as thumbnails as well. Specify a standardized small size for these images to “turn” them into thumbnails. How do I do that – do I specify the thumbnail size in the CSS or somewhere else? What would be a good size? Any code examples would be greatly appreciated as I’m not too familiar with CSS or HTML.
-
When the user submits an URL to an external image, download that image to my own server and turn it into a thumbnail. Any Python/Django software I can use for downloading the remote image and then turning it into a thumbnail?
Any general advices are appreciated. I’m leaning towards option (1) because I only have a cheap VPS and option (1) would be much less resource intensive. Any reason that is NOT a good idea?
Thanks.
I’m fairly sure I saw something exactly like this recently, where you could point a Django model field to a remote image URL and have thumbnails done, but you could also have it upload the image files too. Darned if I cant find it now.
Ah ha! Maybe sorl-thumbnail. Gives this example:
Assuming you can replace a literal string with a URL field (and not an ImageField) from your model ( lot.remoteimageurl for example) then I think that’s it.
sorl-thumbnail will handle thumbnail creation and caching for you.
http://thumbnail.sorl.net/index.html#