Jump to content


This topic is now archived and is closed to further replies.


Random Image help.

Recommended Posts

I was able to successfully write a random image generator via where you can view the image: image.php ...

Heres the script:

[code=php:0]header("Content-type: image/png");
$images = array();
$images[1] = "***";
$images[2] = "***";
$images[3] = "***";
$images[4] = "***";
$imgPng = imagecreatefrompng($images[rand(1, 4)]);
/* Output image to browser */

How can I make the file be viewable as image.PNG instead of image.PHP

I tried .htaccess but it's extremely slow at it. Help anyone?

Share this post

Link to post
Share on other sites
Save it to the file system, then call it from your html page.  Or, change the .png extension to be associated with php so that the php intrepreter will read it...but I'm not sure about the side effects of that on it processing the .png files.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.