Hi, I am representing my Neopets guild, Rapport. I am currently coding a layout for my guild, and am featuring a webcam (randomized images).

An example of the randomized image can be found on xdriftingdreamx's userlookup (refresh for a new banner).

To recreate the user's effect, I need to display (<img src>) a randomized .png image that will change upon refresh.

Neopet's filter disallows:
- image linking to a .php file
- Javascript
- absolute link to any webpage outside of neopets.com

Even with restrictions, the mentioned user has found a way to use PHP to randomize their images while tricking the Neopet filter in believing it as an image file. I am trying to recreate that for the webcam.

----

So far, my image will rotate, but will not display upon <img src>.

PHP:

<?
$files = glob('{.PNG,.png,.JPG,.jpg,.GIF,.gif}', GLOB_BRACE);
shuffle($files);

list($width, $height, $type, $attr) = getimagesize($files[0]);
print("<img src=\"$files[0]\" width=\"$width\" height=\"$height\" alt=\"\" ><br>\n");

//foreach ($files as &$value) {
//print("<img src=\"$value\"><br>\n");
//}

header('Content-type: image/jpeg');
$image = imagecreatefromjpeg($filename);
imagejpeg($image, null, 100);
imagedestroy($image);
exit;

?>

.HTACCESS*

RewriteEngine On
RewriteBase /
RewriteRule Sample_Picture02.jpg$ rotate.php

The .htaccess is supposed to rewrite the rotate.php as an image file, but I am not sure if it actually works; I copied it off a tutorial.

    I am looking through your code..

    a) the images you are trying to access.. are they local on your server, or are you trying to access remote files? According to the php manual, glob() cannot access remote files..

    b) Looking through this line:

    print("<img src=\"$files[0]\" width=\"$width\" height=\"$height\" alt=\"\" \><br>\n");
    

    Notice how the last '\' character after your alt attribute is pointing in the wrong direction... self closing tags should finish with / character.. not the \ character.

    Perhaps one of these issues is what is plaquing your results?

    Cheers,

    NRG

    *edit.. also the <br> is not self closing.. should it not be <br />?

      Write a Reply...