Assuming you meant `app/webroot/img`,

// This is a text link to an image:
echo $html->link('This is an image', '/img/some-image.png');

// This is an image link to another image:
echo $html->image('small-image.png', array('url' => '/img/big-
image.png'));

// So is this:
echo $html->link(
  $html->image('small-image.png'),
  '/img/big-image.png',
  array('escape' => false)
);

If you didn't mean `app/webroot/img`, and you're actually storing
images in `app/img`, then let me be the first to say UR DOIN IT RONG!
If you want a file to be directly web-accessible then it belongs in
the webroot folder. Anything not in the webroot folder cannot be
accessed directly through a url.

If you really really want to keep images outside of the webroot then
you'll have to serve them with a MediaView or some other method - not
a great idea for static images since it creates quite a bit of server
overhead. If you're going for dynamic images, on the other hand, then
it makes perfect sense [though I'd invest in some cacheing].

hth
grigri

On Feb 12, 9:08 am, Adrian Marte <[email protected]> wrote:
> Hi,
>
> How can I create a link to an image (in the app/img directory) using
> the HTML helper? I only find solutions for image links, but not links
> to images.
>
> Thank,
> Adrian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to