eZ Community » Forums » Setup & design » How to display the image which is in...

How to display the image which is in the cache file?

How to display the image which is in the cache file?

Wednesday 26 November 2008 9:48:04 am - 6 replies

Hi All,

I have installed an extension "Human Captcha" on my site, and add the codes following into the template:

<img src={ezhumancaptcha_image()|ezroot()} alt="eZHumanCAPTCHA" />

But it not works now. I checked the source code, found the url of image is: /var/ezflow_site/cache/ezhumancaptcha/0b371fcfc9ab0ea5ca9a5aa3b2bb17eaf30d293f.jpg. Then i check the folder, found the image is there, but if i view via the url: http://mysite.com/var/ezflow_site...c9ab0ea5ca9a5aa3b2bb17eaf30d293f.jpg, it failed.

Is there anybody know how to view an image in the cache file? As i guessed the problem may be because of the view privilege of the cache file.

Wednesday 27 January 2010 5:59:14 pm

I am having the same problem, did you find it was an issue with file or directory permissions on the server?

Saturday 05 February 2011 8:00:52 pm

I have the same problem... in cache, picture is created, but in form there is nothing... how is it possible...??

it looks like it is not accesible...really

Modified on Saturday 05 February 2011 8:40:44 pm by Viktor Belak

Tuesday 08 February 2011 10:51:50 pm

Does anyone knows how to force token image generates image into cache directory of ezhumancaptcha with good permission??? 660 or something... I've tried every possible way and look in whole code, but I have no idea anymore... please...


Wednesday 09 February 2011 7:21:24 pm

I've finally solved the problem...

In class file ezhumancaptchatools.php I've added line with a chmod function and change directory to store token images to storage, also further in the script, it looks like this>

public static function generateImagePath( $encryptedToken )
$ini = eZINI::instance('ezhumancaptcha.ini');
$tokenDirectory = eZSys::storageDirectory() . '/'. $ini->variable( 'GeneralSettings', 'TokenCacheDir' ) .'/';
$tokenFormat = $ini->variable( 'CommonCAPTCHASettings', 'TokenFormat' );

if( !eZDir::isWriteable( $tokenDirectory ) )
eZDebug::writeNotice( 'Cache subdirectory does not exist, attempting to create', 'eZHumanCAPTCHATools::generateImagePath' );
eZDir::mkdir( $tokenDirectory );
$tokenPath = $tokenDirectory.sha1( $encryptedToken ).'.'.$tokenFormat;
chmod( $tokenPath, octdec( eZINI::instance('ezhumancaptcha.ini')->variable( 'CommonCAPTCHASettings','StorageFilePermissions' ) ) );
return $tokenPath;

And in ezhmumancaptha.ini.appen.php I have added under the section CommonCAPTCHASettings this>



And it works actually,


Wednesday 03 April 2013 11:56:13 am

This addition is in the latest versions of the plugin, whoever there is a mistake in it: TokenStorageFilePermission doesn't match StorageFilePermissions. Both of them need to have the same name.

Wednesday 19 November 2014 11:01:12 am

Hi guys,

I was facing the same problem as you. Tried a lot many things (also your suggestion) but at last found out it to be very simple solution in my case. Though this post is very old, I would like to share my solution, may be this can help someone else.
In my host config rewrite rule I modified the line

 RewriteRule ^/var/([^/]+/)?cache/(texttoimage|public)/.* - [L]


 RewriteRule ^/var/([^/]+/)?cache/(texttoimage|ezhumancaptcha|public)/.* - [L]

Modified on Wednesday 19 November 2014 11:04:36 am by Stiff Roy


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from