|
Posted by Jerry Stuckle on 05/30/06 18:12
darthmincho@gmail.com wrote:
> Hi.
> I want to check if an image exists on a remote server, and if it does,
> show it. I
> If it does not exist I want to show a default message. I have
> previously used these chunks of code but none of them have worked. Any
> Ideas?
>
> ------------------------
> $imgCheck=readfile("http.//www.somesite.com/image.gif");
> if($imgCheck) echo "<img border=0
> src=\"http.//www.somesite.com/image.gif\" width=\"550\" height=\"80\"
> alt=\"banner\">";
> -------------------------
> $fp = @fopen("http.//www.somesite.com/image.gif","r");
> if ($fp) {
> echo '<img border=0 src="http.//www.somesite.com/image.gif" width="550"
> height="80" alt="banner">';
> } else { echo 'Resource not valid'; }
> ------------------------
> Thanks ;o
>
readfile() won't work because it echoes the output to the user (unless you've
buffered it).
fopen() should work, though.
It would help if you told us what happens when you try.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|