PDA

View Full Version : Turning .php into a .png [+REP]



Calvin
30-12-2009, 12:59 AM
Quite a nooby question..

But I have a PHP GD image thing which grabs the background colour of the image and the Habbo which you can see here; http://habbotbh.com/avatar/index.php?h=Skizzling&s=2

I would I go about making it so it's habbotbh.com/avatar/index.png?h=Skizzling&s=2

+REP to everyone that helps!

Thanks.

Blinger1
30-12-2009, 01:55 AM
It is a png file, otherwise just use htacess to rename it.. Its called mod_rewrite (http://www.workingwith.me.uk/articles/scripting/mod_rewrite)

Yours would be something like this:



RewriteEngine on
RewriteRule ^index.php?h=$1&s=$2 index.png?h=$1&s=$2

I didn't test the code but it should work?

Calvin
30-12-2009, 02:18 AM
http://habbotbh.com/avatar/index.png

It's just displaying text..

+Rep for helping btw.

Blinger1
30-12-2009, 02:35 AM
What is your PHP code?

Yonder
30-12-2009, 02:57 AM
.htaccess file in the /avatar/ directory:



RewriteEngine on
RewriteRule index.png index.php

Calvin
30-12-2009, 03:03 AM
.htaccess file in the /avatar/ directory:
That works, thanks! :D +rep.

And sorted now Blinger, I think i've +repped you? :D

Blinger1
30-12-2009, 03:06 AM
Yes you have. Sorry, i assumed you knew to put the .htaccess file into the /avatar/ folder.

Want to hide these adverts? Register an account for free!