Re: linking to an image with document_root
| From: | Richard Lynch | Date: | Fri, 01 Jun 2007 22:51:01 +0000 |
| Subject: | Re: linking to an image with document_root | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255991@lists.php.net to get a copy of this message | ||
On Fri, June 1, 2007 3:16 am, 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\"/>";
>
> I am certain the path is correct,
>
> If not what are my alternatives?
You could try if faster than you'll get an answer here, but, yes, you
could do that.
You may even want to set up a variable called $IMAGE_ROOT and set it
to $_SERVER['DOCUMENT_ROOT'] in a config/include file, so that if you
ever want to move all your images somewhere else, you only change one
line of code.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?