Hi,

When using

$external_image = theme('imagecache_external', array(
        'path' => $image,
        'style_name'=> 'media_crop',
        'alt' => $alt));

the generated url us something like "/sites/default/files/styles/media_crop/public/externals/32a181fc065ef59734d5cad6d6beea30.jpg?itok=IOlJVExS" but the real path is sites/default/files/externals/32a181fc065ef59734d5cad6d6beea30.jpg

Did I got something wrong?

Thanks
Rainer

Comments

abelass created an issue. See original summary.

kamkejj’s picture

I have the same issue. Gonna need to debug now. Oh, except on the 8 branch.

BarisW’s picture

No, this is how it should work.

A path in Drupal for images with an image style should look like

/FILES_PATH/IMAGE_STYLE/FILE_STREAM/FOLDER/FILENAME

so

/sites/default/files/styles/media_crop/public/externals/32a181fc065ef59734d5cad6d6beea30.jpg?itok=IOlJVExS makes sense to me, where

FILES_PATH = sites/default/files
IMAGE_STYLE = media_crop
FILE_STREAM = public
FOLDER = externals
FILENAME = 32a181fc065ef59734d5cad6d6beea30.jpg

To find the original file, you can leave out the IMAGE_STYLE/FILE_STREAM part.

Do you see any errors in the logs? You might have forgotten to whitelist the image source domain?

BarisW’s picture

Status: Active » Postponed (maintainer needs more info)
vinmassaro’s picture

Status: Postponed (maintainer needs more info) » Active

@BarisW: I'm noticing that on a site we use this theme function, it is writing the file twice - once to the /sites/default/files/style_name/public/externals directory, and the same files to the configured "imagecache_directory" variable. Is there any way to avoid this so they are just written once? When trying to clear the image style, it times out due to the number of files that can be written into the style directory, and they are not cleared using the imagecache_externals "flush external images" function. Thanks.

smitty’s picture

Well, I think that BarisW is right. He explained, how it should work.

In my case, the problem is - like in the first post of abelass - that the original images are downloaded to files/externals but that the derivate-images in files/styles/media_crop/public/externals are not being generated.

To be exact: It works for 1 template but it does not work for 2 other templates. I tried debugging but I could not find the reason why.

Can anybody help?