I have a View listing all my photo albums and I use an image style for the album cover. I modified the View template file to also include an Instagram gallery. However, calling image_style_url manually on an external link doesn't work because the function can only handle absolute paths.

Is there another built-in function I can use to crop and scale (to get the correct ratio) for an external link?

I'm kind of thinking I have to create the image on the fly on the server to get this to work. Hoping for a clean solution. Thanks.

Comments

E Johnson’s picture

Jumped the gun on the Google Search.

https://www.drupal.org/project/imagecache_external

Jaypan’s picture

Note that by using image_cache on an external link, you will be saving the resized image to your local system. This will use up storage space, but more importantly, it could put you in violation for copying someone's images and hosting them without permission. This could open you up to liability.

Unless you have a good reason for doing this, or are sure that you will never be in copyright violations, you'd be better to resize the external images using CSS, rather than resizing them and displaying the resized image.

Some food for thought.

E Johnson’s picture

Very good point Jaypan. Never really thought of that but it doesn't really apply to my situation. I'll definitely think about it in the future now though.

I think I'll take the risk as the external links are Instagram pictures from my Account. However, that may violate some fine print in Instagram's policy.

I'm just doing it on one external link, grabbing the latest Instagram photo for a Photo Album cover on my website. Also, thanks for making me re-examine cropping in CSS. Never thought about the overflow attribute coming in handy.