tags:

views:

34

answers:

1

I am saving pictures under my web folder in the folder:

web/media/photo

In the template that displays the photo, I have the following snippet:

<?php echo link_to(image_tag('media/photo/filename.jpg', '@some_url); ?>

When I display the view, although the photo is displayed correctly and the link works, I get the following error in my php_errors.log file:

Action "media/photo" does not exist.

Why is symfony trying to parse the path to the image as a url?

Does anyone know how to fix this?

+2  A: 

Add a leading slash to the image path:

<?php echo link_to(image_tag('/media/photo/filename.jpg', '@some_url); ?>

This will prevent Apache from redirecting to the media/photo action in symfony that is matched the mod_rewrite rules in .htaccess.

Raise
`<?php echo link_to(image_tag('/media/photo/filename.jpg', '@some_url); ?>` is also missing some syntax - it should be `<?php echo link_to(image_tag('/media/photo/filename.jpg'), '@some_url'); ?>` but PHP should have thrown a parse error if you'd made that mistake in your code.
Raise