Hi,
Step 1:
Define a custom route for it , e.g:

user_image:
  url: /user/image/:id.jpg
  param: { module: userImage, action: show }

Then your suggested call would work quite well:
<img src="<?php echo url_for('@user_image?id='.$id); ?>" alt="blah" />

Do not know exactly if this would work either:

<?php echo image_tag(url_for('@user_image?id='.$id)); ?>

Step 2:
Check if your new route would be rewritten to your index.php. Go to your .htaccess file or your vhost configs and check your rewrite rules. Especially the lines below
"  # we skip all files with .something"

- Frank

Am 28.01.2010 um 09:06 schrieb Gareth McCumskey:

Hi guys,

I am probably missing something obvious but is it possible for me to
pass in an img tags src attribute the url to an action that will then
output a dynamically generated image?

Example: Instead of a direct link to an image like

<?php echo image_tag('imagename.png'); ?>

I want to do :

<?php echo image_tag('module_name/action_name?param1=value1'); ?>

I know about changing headers and so on on the action side of things
to push out a binary element as opposed to a regular symfony view.
Just wondering what I might need to change routing-wise (if at all) to
get this to work. Maybe I shouldn't even be using the image_tag helper
at all?

<img src="<?php echo url_for('module_name/action_name? param1=value1');?>" />

--
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

--
You received this message because you are subscribed to the Google Groups "symfony users" group.
To post to this group, send email to symfony-us...@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 .


--
You received this message because you are subscribed to the Google Groups "symfony 
users" group.
To post to this group, send email to symfony-us...@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.

Reply via email to