Closed (fixed)
Project:
ImageCache
Version:
6.x-2.0-beta5
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 May 2008 at 15:21 UTC
Updated:
31 Oct 2010 at 12:59 UTC
Jump to comment: Most recent file
Comments
Comment #1
diricia commentedComment #2
drewish commentedI'd suggest that the best way to achieve this is with an an apache header:
Comment #3
dopry commentedI won't be committing this, but it is a good pointer... Maybe a good candidate for a small helper module since it has wider application than just images.
Comment #4
mandclu commented+1 for the original idea. Personally I like the idea of having this in imagecache, especially since it was accomplished with so little extra code and would allow you to selectively trigger downloads in certain instances and not others.
Comment #5
mandclu commentedFWIW, here's a D6 version that also allows for the same functionality. Slightly different structure required.
Also, I should mention the use case for this: I want to make wallpapers available in various sizes. With this small modification, I can now allow a contributor to upload a single file, and users will see an automatically generated thumbnail, plus get a convenient fool-proof download link.
Comment #6
mandclu commentedI re-wrote this as a helper module, but if you look at the code you'll see that except for adding a single header, this module essentially duplicates several functions from the original module. To me, the original changes proposed for imagecache were a much more elegant solution. In any case, here's the download function as a separate module.
Comment #7
drewish commentedit's won't fixed for a reason. you can do it with a 3 lines of apache config. if you want to release and add on module feel free to do so. also don't post .zips for review post a patch file.
Comment #8
mandclu commentedAFAIK, the Apache header you've proposed would force all images to download, which would be a disaster.
We want to be able to upload an image once, then use it in some cases for display within a page, and in other cases have it resized and forced to download. If all that can really be accomplished with three lines of code, I can't see how the three lines above will accomplish it.
Having this as part of imagecache, or even as a helper, could eventually allow even more extended functionality, such as a view display style that could display a thumbnail automatically linked to a download.
As for the .zip, guilty as charged. I can roll a patch if anyone shows any interest in this.
Comment #9
polI'm really interested in this... and changing apache config is a nonsense...
Comment #10
polMaybe you'll find this usefull: http://drupal.org/node/432332 and: http://drupal.org/node/377998
Comment #11
khalemi commentedi'd like to see this patch as a helper module for imagecache, especially for the 5.x 2.4. currently we are building a stock photo site (fotografi.my), we still have no solution but to call javascript to open up a window and display a message for the user to download the image via "Save As"
Comment #12
marcoka commentedhow did you manage to create different image sizes from one uploaded image. i try to upload one image and display different sizes for download at the bottom of the image.
Comment #13
mandclu commentedPol's second link in #10 is an issue in the File Force issue queue, and I have to confess that File Force is probably the best way to address this, although installing a whole module for the sake of something that could be accomplished in this module with so little extra code does seem a tad excessive.
I think the only thing that would still be a big win would be providing a formatter that would make a nice GUI way to set up these downloads (think: "thumbnail linked to original (download)"). I'll open up an issue at File Force.
Comment #14
mandclu commented@e-anima - set up imagecache profiles for the different sizes you want available for download, then use one of the methods in this thread (at this point I'd suggest File Force) to handle the imagecache path with the extra "download" token. You may need to do some extra theming to get the links structured properly, but hopefully a field formatter can be created to address that.
Comment #15
polHi,
That's an old topic ! :)
My patch for D6 has never been accepted... and I still use it for my project without any problem.
Comment #16
marcoka commented#6 not working here, tested it. any ideas?
why should this work -> $items[file_directory_path() .'/imagecachedl'] = array( ...
this path is never accessed, only if you manually relink the files. is that the intention?
at the moment im searching why modules like force_file and x-sendfile only work with the generic output formatter and not with links to /imagecache/preset...
thanks
Comment #17
shaundychkoHere's my solution:
1) put all uploaded images in the same folder, such as /sites/default/files/originals
2) put a .htaccess file in /sites/default/files/originals with the following lines:
<FilesMatch "\.(?i:jpg|jpeg|png|gif)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
The "ForceType" is needed for Internet Explorer. The Regex is case insensitive and requires the match to occur at the end of the filename.
Be sure that the apache headers module is enabled (it isn't by default in Ubuntu 8.04 LTS). In Ubuntu, run
$ sudo a2enmod headers
Comment #19
AdrianB commentedAs pointed out in #8 the Apache header would force all images to download. But besides that most of us using shared hosting does not have access to the Apache config. #17 could work, but I'm not sure it works on all shared hosting. The original suggested solution was a more flexible way.
Edit: Tried File Force, didn't work. Tried this .htaccess solution (which is similary to those suggested here) and that worked.