hotlinking solution

-Anti- - November 1, 2009 - 10:04
Project:Image Resize Filter
Version:6.x-1.5
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Although this module is supposed to just make resized images nice and crisp when resized, IMO a feature that is just as important is the fact that remote images are copied to your server to make them local. This solves the problems associated with hotlinking to images. Eg. On our school website with children linking to images around the Net, I'm going to have to be very aware of other webmasters deciding to serve us porn or sick images instead of the hotlinked images - this is easily done in htaccess.

However, at the moment the copying is done transparently - if the user doesn't resize the image, a local copy isn't created on the server. They're making a decision about the image without even knowing it. So I was wondering if it was possible by adding an option to 'always make a copy of remote images', so it wouldn't be necessary to resize them first? This would still be a transparent action to the user, but puts the decision back into the website owner's hands.

Thoughts?

#1

quicksketch - November 15, 2009 - 23:48

I think this fundamentally falls outside the scope of what this module accomplishes. The ability to resize external images was meant to be a feature that adds consistency to the resizing functionality, it was never meant to be a central feature of the module. I'm generally opposed to adding this, since hosting all remote images was never the purpose of this module and it certainly would not be an expected feature to find in a module that advertises itself as an image resizing utility.

#2

quicksketch - November 16, 2009 - 05:40
Status:active» needs review

Thinking about this further, I definitely see where you're coming from. It's odd that a resized image would be considered "safe" yet an unresized one might cause trouble. The problem I have generally is that an option to "copy remote images locally" could be a module all in itself. However the logic used by Image Resize Filter is rather extensive in terms of finding all the images, determining if it's local or remote, then copying that image locally.

So now I'm weighing the two possible sides of this: Copying images locally is not intended to be a central feature or... copying images locally is inconsistent from the user-perspective depending on if they resize the image or not.

Here's a patch which I'm putting out there for feedback, which does not add any new options to Image Resize Filter. Instead it simply assumes all remote images should always be copied; resized or not. In other words the administrator doesn't even get an option to decide if the behavior should be consistent or not, all images are copied locally no matter what if the option is enabled. I added a single exception for 1x1 images, which are frequently used in tracking scripts as the non-JavaScript fallback.

AttachmentSize
image_resize_filter_external_images.patch 3.69 KB

#3

-Anti- - November 17, 2009 - 00:34

Thanks for following this up.
I would also be interested to hear other opinions with regard to 'hotlinked vs localised' images.

I'll try to test out the patch in the next couple of weeks.

#4

helmo - November 18, 2009 - 15:10

I just applied the patch and experimented a little. It works as expected for me.
About caching all remote images: It seems sensible and reduces complexity for the admin.

Since I had recently wished for such functionality I am really glad you implemented this, and hope it can be committed soon.

 
 

Drupal is a registered trademark of Dries Buytaert.