Re: Link to Image using Helpers

2009-02-18 Thread Adrian Marte

Worked! Thanks a lot.

Quite obvious when I think about it ;)

On 12 Feb., 11:35, grigri  wrote:
> 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  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 cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Link to Image using Helpers

2009-02-12 Thread grigri

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  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 cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Link to Image using Helpers

2009-02-12 Thread dr. Hannibal Lecter

If by app/img you mean app/webroot/img, then the standard $html->link
() should be sufficient, right?

http://api.cakephp.org/class/html-helper#method-HtmlHelperlink

On Feb 12, 10:08 am, Adrian Marte  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 cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Link to Image using Helpers

2009-02-12 Thread Adrian Marte

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---