How to use .jpg?text=123 insted of .php?text=123

GD and GD2 are useful libraries for creating graphics on-the-fly. Discuss your PHP GD and GD2 scripts here.

Moderators: onion2k, General Moderators

Post Reply
manjifera
Forum Newbie
Posts: 8
Joined: Sun May 11, 2008 2:52 am

How to use .jpg?text=123 insted of .php?text=123

Post by manjifera »

Hello all i am creating one iplogger which also takes data from user like user name etc etc ...
how to use .jpg instead of .php

i hear we have to use .htaccess file.. any idea?

e.g this...
<a href="http://www.nbfun.net/image" target="_blank"><img src="http://nbfun.net/image.gif?uid=11219363 ... +TEXT+HERE" alt="www.nbfun.net"></a>

Image
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: How to use .jpg?text=123 insted of .php?text=123

Post by Kieran Huggins »

You have two options:

add jpg as a PHP script extension for that folder

Code: Select all

AddType application/x-httpd-php .php .jpg

or silently redirect using mod_rewrite to a PHP file: 
[code=.htaccess]Options +FollowSymLinks +Indexes
RewriteEngine on
RewriteBase /
RewriteRule ^image.([^.]+)\.jpg$ image.php?text=$1 [L]
that last snippet cleans up the request to turn [b]image.123.jpg[/b] into [b]image.php?text=123[/b]. The benefit of that is browsers will cache the image and save you some overhead. Also, it looks nicer IMO and is easier to remember / say / type.
manjifera
Forum Newbie
Posts: 8
Joined: Sun May 11, 2008 2:52 am

Re: How to use .jpg?text=123 insted of .php?text=123

Post by manjifera »

hello thanks for great help :-) its works ..
Its now looks like this : :D :D :D

Reg
Prashant
Last edited by onion2k on Sun May 18, 2008 6:56 am, edited 1 time in total.
Reason: Image removed. Don't display people's IP addresses. It's a security risk.
Post Reply