On Thu, Apr 14, 2011 at 2:59 AM, Mr.Jayesh <[email protected]> wrote:
> I would really like to thank everyone for their valuable input.
> See, as per the discussion so long, I would like to make some things
> clear. I have a picture column that saves the filename and also a dir
> column that saves the directory root. I have set the upload path to
> img{DS}tablets. that saves the directory info like " img/tablets "
> into the dir column.
>
> I tried various combination, at last finalized with this:
> <?php echo $html->image('..' . DS . 'img' . DS . 'tablets'. DS .
> $medicine['Medicine']['picture']); ?>
Instead of hard-coding the path you should use the value that's in the
database. You should have it in $medicine['Medicine']['dir'] unless
you've specifically left it out of fields option in the find().
Also, the path parameter for the image method assumes that the path is
relative to '/img' unless it begins with a '/' or contains '://'.
Because your dir column contains 'img/tablets' you should do:
echo $html->image(
DS.$medicine['Medicine']['dir']
.DS.$medicine['Medicine']['picture']
);
http://api.cakephp.org/class/html-helper#method-HtmlHelperimage
--
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