"Jez" a écrit le 19/11/2003 :[color=blue]
> I'm looking at using random image rotation on one of my sites and have
> found the following script very helpful:
>
>
http://www.alistapart.com/d/randomizer/rotate.txt
>
> Everything works, but once you've randomly chosen the file on the
> server wouldn't it be simpler/quicker to say ...
>
> if ($img!=null) {
> header("Location: ".$img."");
> }
>
> instead of ...
>
> if ($img!=null) {
> $ext = strrchr($img,'.');
> if ($ext==".jpg") $ext = ".jpeg";
> $contentType = 'Content-type: image/' . substr( $ext, 1,
> (strlen($ext)) );
> header ($contentType);
> readfile($img);
> }
>
> I'm no expert, but this seems to work for me.
>
> Please let me know if I've got this all wrong?[/color]
Because the first one force the Web Client to show only the image
whereas the second could be used in a HTML page in a <img> tag.
Assuming you php page is rotate.php with the second you could use in
any HTML page :
<img src="rotate.php" alt="My rotated image">
You simply can't whith your method.