Making .php look like .png for forums

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Donkey
Forum Newbie
Posts: 3
Joined: Sat Mar 07, 2009 7:53 am

Making .php look like .png for forums

Post by Donkey »

Hi, i have a dynamic sig I wish for my users to use on forums: http://extremeteenforums.com/forums/sig.php

However, it does not work in [img] tags as it is a .php file. I need a way to make it look like a .png file so this would work..

Help please.
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: Making .php look like .png for forums

Post by Mark Baker »

Code: Select all

<img src="http://extremeteenforums.com/forums/sig.php">
is perfectly valid and should work without any problems, so long as sig.php actually returns a valid image with the appropriate headers.

If it isn't working, then the problem is somewhere in sig.php, but as we have no idea what the code looks like, we can't do much to help
Donkey
Forum Newbie
Posts: 3
Joined: Sat Mar 07, 2009 7:53 am

Re: Making .php look like .png for forums

Post by Donkey »

Hi,

I was trying to use it on forums which didn't allow embedded php (for obvious reason)-

But I have got this to work by creating a sub directory called signature.png, and putting it there as index.php
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Making .php look like .png for forums

Post by requinix »

You can actually use a URL like

Code: Select all

http://extremeteenforums.com/forums/sig.php/image.png
If sig.php exists then the "/image.png" at the end won't make any difference.
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: Making .php look like .png for forums

Post by panic! »

assuming you're using apache, if the url is http://extremeteenforums.com/forums/sig.php

in the /forums/ folder create a text file called .htaccess and within it paste:

Code: Select all

 
RewriteEngine On
RewriteRule sig.png sig.php
and now http://extremeteenforums.com/forums/sig.png will be routed into sig.php by apache.
Donkey
Forum Newbie
Posts: 3
Joined: Sat Mar 07, 2009 7:53 am

Re: Making .php look like .png for forums

Post by Donkey »

panic! wrote:assuming you're using apache, if the url is http://extremeteenforums.com/forums/sig.php

in the /forums/ folder create a text file called .htaccess and within it paste:

Code: Select all

 
RewriteEngine On
RewriteRule sig.png sig.php
and now http://extremeteenforums.com/forums/sig.png will be routed into sig.php by apache.
This was really practical and useful, thanks!
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: Making .php look like .png for forums

Post by panic! »

Glad to see it's working for you ;)

http://extremeteenforums.com/forums/sig.png
Post Reply