Re: linking to an image with document_root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Fri, June 1, 2007 6:33 pm, chris smith wrote:
> On 6/2/07, Richard Lynch <ceo@xxxxxxxxx> wrote:
>> 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.
>
> How's that going to help when the OP is using a *file path* as an
> image source ?

Because if he tries it, he'll find out it wont' work.

And if he has it only ONE place to fix, then that's better than having
it all over his site, once he finds out that DOCUMENT_ROOT is wrong,
but something like HTTP_HOST is right.

-- 
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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux