VladimirKon Posted January 5, 2015 Share Posted January 5, 2015 (edited) I'm trying to adapt one thing to prestashop but currently i'm out of luck. I'm using plupload plugin to upload images and then rename file name to session_id.jpg (e.x 34lkjdflkjfdl345fd.jpg ) Upload and rename parts works fine as it's upload file to sitename.com/tmpfile/******.JPG But the question is - how can i display uploaded picture in prestashop? Since you can't use something like this in .TPL file. $fileimg = "default/default-logo.jpg"; $fileimg2 = './tmpfile/' . session_id() .'.jpg'; <img src="<?php If (file_exists($fileimg2)) { echo $fileimg2; } else { echo $fileimg; } ?>" alt="Face"> Thanks. Edited January 5, 2015 by VladimirKon (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 5, 2015 Share Posted January 5, 2015 how you define this session id ? it's based on real session id or you just generate this string? Link to comment Share on other sites More sharing options...
VladimirKon Posted January 5, 2015 Author Share Posted January 5, 2015 how you define this session id ? it's based on real session id or you just generate this string? It's not real session id Link to comment Share on other sites More sharing options...
fred-vinapresta Posted January 5, 2015 Share Posted January 5, 2015 (edited) Hi, in the controller or hook function which will render the template where you want the picture appears, you have to assign the session id to smarty: $this->context->smarty->assign('my_session_id', session_id()); then in your template, you can put something like <img src="{$base_dir}tmpfile/{$my_session_id}.jpg" /> Edited January 5, 2015 by fred-vinapresta (see edit history) 1 Link to comment Share on other sites More sharing options...
VladimirKon Posted January 5, 2015 Author Share Posted January 5, 2015 Hi, in the controller or hook function which will render the template where you want the picture appears, you have to assign the session id to smarty: $this->context->smarty->assign('my_session_id', session_id()); then in your template, you can put something like <img src="{$base_dir}tmpfile/{$my_session_id}.jpg" /> Thanks you so much! This is what i was looking for:) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now