Geoff, All, I figured it out :) I needed to reference "/app/webroot/img/img01.png"
Figured out by using the helper and then viewing the source created by my browser! Hope that helps someone else. Now I can add my images with the correct relative path and save the helper for links :) Regards, Tim On Fri, Dec 16, 2011 at 10:42 AM, Timothy O'Reilly < [email protected]> wrote: > Geoff, > Thanks for replying and taking it easy on me :) > > Funny thing is that this works for me: > <?php echo $this->Html->image('img01.png', array('alt' => 'document')); > ?> > > And this doesn't: > <img src="/img/img01.png" width="104" height="128" alt="document" /> > > > I am using Cake Ver 2.0.4 with standard files and folders setup. > Just dunno what I am doing wrong. Will use Helpers if I have too, but > seems a little redundant for much of my landing page :( > Regards, > Tim > > > > On Fri, Dec 16, 2011 at 10:20 AM, Geoff Douglas <[email protected]>wrote: > >> Just in case you are confused... even by the documentation... >> >> The Html Helper only creates HTML. So if you use the image() method, it >> will output the actual img tag with all the attributes. >> >> The src is going to use the path to the image that you specify, and with >> cake the webroot folder is where /your/relative/path will default to. >> >> So, you have stored your image in the >> {app}/{webroot}/img/blogtest/image.jpg... that is what you use in your src >> attribute, if you are creating the HTML by hand. (<img >> src="/img/blogtest/image.jpg" />) >> >> The PHP code will be <?php echo >> $this->Html->image('blogtest/image.jpg',array('rel'=>'your_rel','id'=>'your_id')); >> ?> >> This will output <img src="/img/blogtest/image.jpg" rel="your_rel" >> id="your_id" /> >> >> There is no real funny business here, it's just a helper. But it does >> default to the /img folder, unless you specify a full http://address. >> >> Happy Coding! >> >> -- >> Our newest site for the community: CakePHP Video Tutorials >> http://tv.cakephp.org >> Check out the new CakePHP Questions site http://ask.cakephp.org and help >> others with their CakePHP related questions. >> >> >> To unsubscribe from this group, send email to >> [email protected] For more options, visit this group >> at http://groups.google.com/group/cake-php >> > > > > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
