Results 1 to 5 of 5
November 17th, 2005, 09:47 PM #1
Hotlinked Image Resizing
- Join Date
- January 18th, 2005
I'm using datafeeds from merchants that have only one size image, and that's the large one.. I call these remotely and then generate thumbnails on the fly from them.. Problem is the sizing..
If I set absolute values (height & width) for the thumbnail, it distorts the image to match the dimensions.. If I just set only one, say height, I get the thumbnail in proportion, however the page takes forever to load (approx 30 seconds rather than 5 seconds for both absolute).. I have tried using GD to auto resize the images in proportion on the fly, however this also takes approx 30 seconds to load a page.. I also tried image caching with the GD but it was still sloooow.. At present the fastest loading (absolute) looks like crap (imaging a wine bottle pic at 100x100px ) , and the slow loading looks great..
What options have others done to to get quick loading pages, but also display thumbnails in proportion? Is there any way I can do this at a hotlinked level?
November 17th, 2005, 10:27 PM #2
I usually check the merchant site for thumbnails and try to figure out what I need to do to the large image URL to find the thumbnail URL. Sometimes it's only a matter of adding a _t.jpg to the end of the image or swapping out /products with /thumbnails from the URL. This works 90% of the time. For the other 10% I either don't use the feed, use a "No Image Available" image or email the merchant and ask them to add thumbnails. If none of these are an option for you, you can write a script that will download all of the images with wget and resize them with GD behind the scenes. That way you'll have all the images stored on your server in the appropriate size.
- ScottHatred stirs up strife, But love covers all transgressions.
November 18th, 2005, 12:49 AM #3
- Join Date
- January 18th, 2005
I had a look at grabbing the thumbnail urls but there is a fair whack of variation involved with the merchants.. I've decided to use wget as a solution for now..
November 18th, 2005, 02:10 AM #4
Check for flash at the very start of your page. If the visitor has flash installed, instead of an img tag, use a very lightweight flash movie that takes an argument for a picture URL (from the server the flash movie was served from -- you will have to download the images) -- and have the movie resize and crop on the fly. If you want to get fancy, you can easily add function to your flash movie to blow the picture up or pan around in a smaller space (a la google maps). Cheers,
Originally Posted by TK
January 4th, 2006, 02:30 PM #5
If you use PHP, you can check the absolute size of the image and present an absolute thumb size to the user using a bit of math:
list($width, $height, $type, $attr) = getimagesize("img/flag.jpg");
list($width, $height, $type, $attr) = getimagesize("http://foobar.org/img/flag.jpg");
$aspectRatio = $height / $width ;
echo "<img src='image.jpg' height='150' width='" . ($aspectRatio * 150) ."'>";
However, the better solution for your dialup users is to generate thumbs in advance, or find a source for them from your merchant, as you are still asking them to download the fullsize image.
By echi in forum Commission Junction - CJReplies: 13Last Post: February 13th, 2008, 01:08 AM
By burnden in forum WebMerge (Fourthworld.com)Replies: 1Last Post: December 31st, 2006, 09:56 PM
By purplebear in forum ShareASale - SASReplies: 9Last Post: August 10th, 2006, 08:33 AM
By billbam in forum WebMerge (Fourthworld.com)Replies: 1Last Post: June 11th, 2004, 07:26 PM
By weisinator in forum Programming / Datafeeds / ToolsReplies: 0Last Post: May 6th, 2004, 10:12 AM