Re: linking to an image with document_root
| From: | Shafiq Rehman | Date: | Fri, 01 Jun 2007 09:09:14 +0000 |
| Subject: | Re: linking to an image with document_root | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255962@lists.php.net to get a copy of this message | ||
Hi,
You cannot use document_root to get the paths for images. You can write a
function to get the images url in your application.
function imageServer()
{
return "/images/";} -- Shafiq Rehman (ZCE) http://www.phpgurru.com | http://shafiq.pk Cell: +92 300 423 9385 On 6/1/07, Chris <dmagick@gmail.com> wrote: > > blueboy wrote: > > May be a stupid question but can I link to images with doscument root > > > > $img_url= $_SERVER['DOCUMENT_ROOT'].'/images/holder.gif'; > > > > echo "<img src=\"$img_url\" width=\"250\" height=\"163\"/>"; > > An image source is the URL to that image. > > The server document root is the local location of that file (eg > /home/user/file.gif) - which is never going to work as a URL. > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >