custom generated image storage location

guardian - April 26, 2008 - 18:25
Project:ImageCache
Version:5.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:patch (code needs work)
Description

hi, here is a first try as providing custom storage location for imagecache.

the patch attached enables you to get files/images/cache/[preset]/images/woot.jpg<code> urls instead of <code>files/imagecache/[preset]/images/woot.jpg

why ? because i like it like that baby

feel free to review, comment, whatever

cheers, g.

AttachmentSize
imagecache_custom_directory.patch3.22 KB

#1

guardian - April 26, 2008 - 18:27
Status:active» patch (code needs review)

#2

guardian - April 26, 2008 - 18:28

by the way, the patch has been generated from CVS, DRUPAL-5--2 branch

#3

guardian - April 26, 2008 - 18:33

fixing indentation

AttachmentSize
imagecache_custom_directory.patch3.23 KB

#4

dopry - April 27, 2008 - 03:53
Status:patch (code needs review)» patch (code needs work)

the patch looks pretty good at a glance. It needs additions to the requirements to verify the path is writable. Also as validation for the imagecache path settings form input. I'd prefer to see an element validator.

#5

guardian - April 27, 2008 - 09:43

ok here is another try

i just discovered about hook_requirements, this new patch does:

  • in imagecache.install
    • change the path checked at the runtime phase
    • delete the imagecache_directory_path variable at uninstall
  • in imagecache.module
    • replaced '#after_build' => array('system_check_directory') by a validate function
    • fixed paths for 403 and 404 images
AttachmentSize
imagecache_custom_directory.patch5.64 KB

#6

guardian - April 28, 2008 - 14:50

new patch taking http://drupal.org/node/66763 into account

now, the custom directory for image derivatives has to lie in side drupal's files/ directory which has a proper .htaccess file

AttachmentSize
imagecache_custom_directory.patch4.74 KB

#7

guardian - April 28, 2008 - 15:21

sorry i uploaded the wrong patch
this one should be correct

AttachmentSize
imagecache_custom_directory.patch4.76 KB

#8

guardian - April 28, 2008 - 18:31
Status:patch (code needs work)» patch (code needs review)

#9

dopry - April 30, 2008 - 15:19

I'll have to look, but I think that .htaccess file that prevents Apache multi type exploits doesn't apply to imagecache generated derivatives... since we know they're images... so we can technically move imagecache anywhere... including /imagecache or /images when I'm working on 2.1 we'll figure this one out.

#10

guardian - April 30, 2008 - 15:38

does it delay the patch until 2.1 or only allowing the derivatives to be outside the files directory ?

#11

dopry - May 7, 2008 - 20:30

yes. I'm not doing any more feature additions for 2.0.

#12

guardian - June 2, 2008 - 18:05

updated patch to current head, please consider it while it applies

cheers

AttachmentSize
imagecache_custom_directory_path.patch4.79 KB

#13

headkit - July 3, 2008 - 09:55

i tried the latest of your patches from that link and i can change the path of imagecache now. thats nice and it creates the imagecache folder outside the installationpath of drupal, but it does not create a preset-folder and no image file.

please help,
thnx!!!

#14

headkit - July 9, 2008 - 13:04

nothing?

#15

drewish - July 26, 2008 - 01:34
Status:patch (code needs review)» patch (code needs work)

no longer applies to head.

#16

guardian - July 26, 2008 - 10:29
Version:HEAD» 5.x-2.x-dev

which doesn't surprise me since it was a 5.x patch and now HEAD is 6.x

when I synced the patch with HEAD it was still 5.x (http://drupal.org/node/251597#comment-866944) - I asked dopry if he could have a quick look but he answered he had no time to do so and that asking would not help

I'm sorry, I don't run D6 yet

I also switched the version to 5.x-2.x-dev since the patch originally came from CVS, DRUPAL-5--2 branch

#17

Psicomante - August 12, 2008 - 19:22

good patch, will it apply to 5.x?

 
 

Drupal is a registered trademark of Dries Buytaert.