NameSilo

PHP Script Image

SpaceshipSpaceship
NamecheapNamecheap
Namecheap AuctionsNamecheap Auctions
Watch

iNod

Eating PieVIP Member
Impact
66
Hello,

On a site profilepeep.com they give you a code as the following

Code:
<a href="http://www.profilepeep.com/" target="_blank">
<embed src="http://www.profilepeep.com/j/113152.jpg" border="0" height="0" width="0">
</a>

How do they get php into an image? I know that image has php than it displays a 1x1 pixel jpg image.. I know there is also a header("Content-type: image/jpeg"); code in there.. But how do I get it so I can have php in a file something.jpg or something.gif ?? I was thinking mod_rewrite.. OR even having that image "rewrite" to a phpfile like userid.jpg actually is somefile.php?uid=userid

For example
$userid = 1121
stat.php?uid=1121
1121.gif "rewites to" stat.php?uid=1121

Get that?

- Steve
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
.htaccess
Code:
AddType application/x-httpd-php .png .gif .jpg

And just open notepad...add your code.. save as .jpg or w/e.
 
0
Close
lol.. You know.. That sounds simple lol..

Now next question.. How can I do it so I cna pass variables through the image name? 111111.jpg = stat.php?uid=111111 or something.

Thanks SV.. As always..

- Steve
 
0
Close
Adding that code to .htaccess will treat the file just like a .php file. You could pass params and use $_GET.
 
0
Close
I found out how I can do this.

Using mod_rewrite.

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} .*jpg$|.*gif$|.*png$ [NC]
RewriteRule (.*) /showpic.php?pic=$1

I just change an antileech script I found to work for what I need.

- Steve
 
0
Close
Here's the exact code.

.htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)\.jpg$ /showpic.php?pic=$1 [L]


^ The above is all you need. :)

- tsM
 
0
Close
nice script there mate
 
0
Close
Yes, this is a nice way to track bandwidth, hits, size, etc. :)
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back