With imagefield now supporting private downloads, it's actually a no-brainer to make imagecache support them too. Just add the appropriate menu entry, remove the requirement message, and you're done. There's nothing in imagecache that actually depends on public downloads, specific arg() calls, or other hurdles that would prevent private downloads to work. Pretty cool, right? ;D
Applies to the DRUPAL-5--2 branch.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | imagecache-leo_pape.patch | 17.14 KB | jpetso |
| #7 | imagecache.module_5.patch | 26.44 KB | leop |
| imagefield-private-downloads.patch | 2.48 KB | jpetso |
Comments
Comment #1
ezra-g commentedThank you for working on this!
I've successfully applied the patch, and images do display, however none of the actions defined in my presets are taking effect. The images are displaying at original size. All of the files in .../privatefiles/imagecache/images are duplicates at original size:
BLUEMANGROUP1-rgb_0.jpg
BLUEMANGROUP1-rgb_1.jpg
BLUEMANGROUP1-rgb_2.jpg
BLUEMANGROUP1-rgb_3.jpg
Please let me know if I can provide any other information!
Comment #2
jpetso commentedNo, sorry, that doesn't happen at my place, I don't know what could be causing it. I suggest to wait for this patch being applied, and to open a new issue then, it doesn't quite belong in this one.
Comment #3
ezra-g commentedI have now tested this patch on a MAMP installation as well as a default Redhat server and am observing the same behavior: Imagecache presets are not affecting images. Images are displayed at original size. For example: my Imagecache preset 'gallery' includes 2 steps: Scale outside of 165x165 pixels, then crop to 165x165 with offset set to center. This preset is called in node-image.tpl.php with the line
Perhaps I missed a step. Could you please clarify what you mean by "Just add the appropriate menu entry, remove the requirement message, and you're done."?
Comment #4
ezra-g commentedHas anyone had been able to get imagecache to work sucessfully with private files after applying this patch?
Comment #5
jpetso commented> Could you please clarify what you mean by "Just add the appropriate menu entry, remove the requirement message, and you're done."?
Sorry, I meant that code-wise. Menu entry, as in "item that is returned by hook_menu(), and catches system/files/*". Requirement message, as in "the thing that causes the admin root page to display a warning that public downloads are required". Nothing you have to do by yourself (it *should* just work).
Comment #6
jpetso commented> This preset is called in node-image.tpl.php with the line [snip]
Maybe there's a difference in calling the imagecache theme function directly vs. letting imagefield (with the preset as field display method) do it. I need a break from image{field,cache} so I'm not currently motivated to research this.
Please try if it works in an imagefield, and maybe have a look at imagefield's theming code. If that doesn't work, try to apply the immediate image previews patch for imagefield, and try again (I changed the filepath stuff a bit there, your problem might stem from the same origin as image previews). If that still doesn't work, you can ask me for my heavily patched module set. And if that doesn't work, you might wait for the next best coder who is annoyed enough to fix it, or try it for yourself.
Comment #7
leop commentedHi,
I fiddled a bit with the code, and here is my solution for private downloads. I checked it for public and private downloads, as well as clean and 'unclean' urls, and it all works fine. I must say that I didn't check anything with the CCK module, but I think my changes will not affect this. By the way, I have no access to CVS and no patch program either, so I supply it as a module (not a patch). Sorry for that. The reason the file has the .patch extension is that drupal won't let me update other extensions.
Comment #8
ezra-g commentedThanks for submitting this.
Unfortunately, this alternate version of the module didn't work for me. Can you describe the changes you made to the module or the change in behavior you observed? To clarify, when you said that you didn't check anything with the CCK module, were you using the CCK imagefield?
For me, this generated an
element that pointed to a nonexistent image:
http://example.com/imagecache/gallery/images/Blue+Man+Group_0.jpg
Also, you might be interesed in these handbook pages:
How to checkout a module from CVS (You can do this anonymously): http://drupal.org/node/120511
How to create a patch: http://drupal.org/patch/create
Comment #9
jpetso commentedWell I don't dislike Windows users per se, but...
Apart from that, there's no way that imagecache can work with public downloads AND clean urls, without pre-generating images (which imagecache does not intend to do). It's just not possible, because of the way that imagecache intercepts menu paths. Don't delete the concerned requirement message and claim it works, because it can't.
Apart from that as well, I still vote for the inclusion of my patch. Less intrusive, clearly scoped.
Comment #10
leop commented@jpetso Thanks a lot for your help.
I think the patch you supplied works with private downloads only. I tried to come up with a more general solution that works regardless of the drupal file download method. And yes, I did change the way in which imagecache intercepts paths.
You might have a look at the patch and its description.
Comment #11
jpetso commented@leo_pape:
Yes, my patch works with Private downloads only, in addition to the already working Public download method with Clean URLs enabled. I explained in your new issue why this is the maximum of what's possible if you want to keep the characteristics of Public downloads.
Comment #12
jpetso commentedOn further thought, it should actually be possible to support Public downloads without Clean URLs - we just need to handle those (and only those, not the ones _with_ Clean URLs) like Private downloads. That nukes the performance gains of Public downloads of course, but in opposition to what is the case now, it would actually work. I'll look into improving my patch into this direction. Like, er, Soon(tm).
Comment #13
leop commentedI tried to implement this in my most recent patch. You might want to take a look at it "/node/141127#comment-240434">here.
Comment #14
jpetso commentedMy patch from here is now deprecated, its official successor has been posted to issue #141127. Closing this issue with "duplicate" status.