Forums / Setup & design / How to display the image which is in the cache file?

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

Author Message

zfirst zlast

Wednesday 26 November 2008 12:48:04 am

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/cache/ezhumancaptcha/0b371fcfc9ab0ea5ca9a5aa3b2bb17eaf30d293f.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.

Duffy Walsh

Wednesday 27 January 2010 8:59:14 am

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

Duffy Walsh

Viktor Belak

Saturday 05 February 2011 11:00:52 am

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

Viktor Belak

Tuesday 08 February 2011 1: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...

viktor

Viktor Belak

Wednesday 09 February 2011 10:21:24 am

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>

[CommonCAPTCHASettings]

TokenStorageFilePermission=0660

And it works actually,

VikTor

eZ debug

Timing: Jan 18 2025 00:47:17
Script start
Timing: Jan 18 2025 00:47:17
Module start 'content'
Timing: Jan 18 2025 00:47:18
Module end 'content'
Timing: Jan 18 2025 00:47:19
Script end

Main resources:

Total runtime1.2733 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 587.9375180.8125
Module start 'content' 0.00681.1616 768.7500609.6719
Module end 'content' 1.16840.1048 1,378.4219337.3672
Script end 1.2732  1,715.7891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.3494210.0002
Check MTime0.00180.1406210.0001
Mysql Total
Database connection0.00090.069210.0009
Mysqli_queries1.189693.42232020.0059
Looping result0.00200.15602000.0000
Template Total1.238997.320.6195
Template load0.00230.177720.0011
Template processing1.236697.121020.6183
Template load and register function0.00020.017710.0002
states
state_id_array0.00140.110310.0014
state_identifier_array0.00180.141320.0009
Override
Cache load0.00190.1509510.0000
Sytem overhead
Fetch class attribute can translate value0.00260.200440.0006
Fetch class attribute name0.00210.165170.0003
XML
Image XML parsing0.00280.217040.0007
class_abstraction
Instantiating content class attribute0.00000.001990.0000
General
dbfile0.00550.4352330.0002
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 32
 Number of unique templates used: 8

Time used to render debug report: 0.0002 secs