You are here: Re: PHP Image by Default « All PHP « IT news, forums, messages
Re: PHP Image by Default

Posted by Fred Atkinson on 08/31/07 01:31

On Thu, 30 Aug 2007 00:14:36 -0400, Jerry Stuckle
<jstucklex@attglobal.net> wrote:

>Fred Atkinson wrote:
>> On Tue, 28 Aug 2007 16:17:09 +0100, "peter" <submit@flexiwebhost.com>
>> wrote:
>>
>>>> It returns null, which brings up a blank image.
>>> then you can simply do something such as:-
>>>
>>> <?PHP
>>> $image = getRandomImage('LL/');
>>> if (is_null($image))
>>> {
>>> $image = '';// Set to the image you wish
>>> }
>>> echo "<img src='$image' height=90 width=120 alt='LL'>";
>>> ?>
>>>
>>> in the if statement place the path and name of the image you want to use as
>>> the image that will be displayed if nothing is returned from the function.
>>>
>>
>> When I use this:
>>
>> <?php
>> $image = getRandomImage('LL/');
>> if (is_null($image))
>> {
>> $image = 'none.jpg';// Set to the image you wish
>> }
>> echo "<img src='$image' height=90 width=120 alt='LL'>";
>> ?>
>>
>> and pull up the Web page I look at the source and I see this:
>> <img src='' height=90 width=120 alt='LL'>
>>
>> As you can see the 'none.jpg' default file is not coded into
>> the resulting HTML.
>>
>> Any idea why?
>>
>> Regards,
>>
>>
>>
>> Fred
>>
>
>Because it's returning an empty string - which is NOT the same as null.

As you can see, I am defining the string as none.jpg. I can't
imagine why it still thinks it is null.




Fred

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация