Why not give the following a try? <?php echo link_to(image_tag('/uploads/myimages/'.$image_name), '/uploads/myimages/'.$image_name) ?>
On Fri, Mar 12, 2010 at 5:58 PM, Luis Alberto Zarrabeitia <zarrabei...@gmail.com> wrote: > On Fri, Mar 12, 2010 at 2:00 AM, Gareth McCumskey <gmccums...@gmail.com> > wrote: >> In your template: >> >> <?php echo >> image_tag($sf_config->get('sf_upload_dir').'/myImages/'.$image_name) >> ?> >> >> The $sf_config variable is a copy of the sfConfig object used in the actions. > > Thank you, but I'm afraid that didn't work. Instead, it printed the > error message: > > Notice: Undefined variable: sf_config in ..path/to/the/template.php.. > on line 24 Fatal error: Call to a member function get() on a > non-object in .... on line 24. It seems that $sf_config is not > available in my template. Does that make any sense? (symfony 1.4 > here). > > Instead, I tried using sfConfig::get('sf_upload_dir'). The result was > slightly better: > > <img > src="/myapp/projects/myapp/web/uploads/myImages/5e1a2b0308e404ecd8128b933f667274039e9e59.jpg" > /> > > The first "/myapp/" is the right webpath to the /web/ directory, but > sf_upload_dir seems to hold the filesystem path to the upload > directory (/projects/myapp/web/uploads/), rather than the webpath. > > Remiving it form the path yielded better results: > > <?php echo image_tag('/uploads/myimages/'.$image_name) ?> did display > the image tag, though it has the /uploads/ part hardcoded. > > Moreover, it produces the image tag, but I can't find the way to > access the url (for instance, if I want to link to it). Any thoughts? > > (and where can I find the list of functions and variables I can use > from the template?) > > Thanks, > > Luis. > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- Gareth McCumskey http://garethmccumskey.blogspot.com twitter: @garethmcc -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en