Forums / Developer / Image dowload

Image dowload

Author Message

Fabien Mas

Thursday 19 April 2007 1:37:55 am

Hi, I would like to create a link to download different types of files
My download URL is : /content/download/$objectID/$attributeID/file/$original_file_name

It works for pdf, doc,rtf,... files but not with images(jpg,png,..)
What Can I do to get it working ?

Thx, Fabien :)

Egil Fujikawa Nes

Thursday 19 April 2007 2:13:33 am

Hi Fabien,

This can be related to your rewrite rules of Apache. Earlier documentation of Virtual host configuration could be as simple as this:

RewriteEngine On
RewriteRule !\.(gif|css|jpg|png|js|asf|avi|wmv|swf|xsl|jar)$ /index.php

As you can see this will not allow jpg or gif files to be accessed trough the download functionality of eZ publish.

The new documentation give a lot more complex RewriteRule:

RewriteEngine On
Rewriterule ^/var/storage/.* - [L]
Rewriterule ^/var/[^/]+/storage/.* - [L]
RewriteRule ^/var/cache/texttoimage/.* - [L]
RewriteRule ^/var/[^/]+/cache/texttoimage/.* - [L]
Rewriterule ^/design/[^/]+/(stylesheets|images|javascript)/.* - [L]
Rewriterule ^/share/icons/.* - [L]
Rewriterule ^/extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?)/.* - [L]
Rewriterule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^/packages/styles/.+/thumbnail/.* - [L]
RewriteRule ^/favicon\.ico - [L]
RewriteRule ^/robots\.txt - [L]
RewriteRule .* /index.php

It's no longer the file extension but the file location that's relevant for how the file will be handled by Apache.

Hope this can help you to sort out your problem :)

BuildCMS - Av. Paulista 777, 15° Andar - CEP: 01311-100 - São Paulo
URL: http://www.buildcms.com

Fabien Mas

Thursday 19 April 2007 2:23:46 am

It will help for sure,

thx :)

Fabien Mas

Thursday 19 April 2007 6:06:43 am

Actually, it was my entire fault, I made a mistake to set the attributeIDwith images (not with files) ...