PHP Script Image

NamecheapNamecheap
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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
.htaccess
Code:
AddType application/x-httpd-php .png .gif .jpg

And just open notepad...add your code.. save as .jpg or w/e.
 
0
•••
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
•••
Adding that code to .htaccess will treat the file just like a .php file. You could pass params and use $_GET.
 
0
•••
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
•••
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
•••
nice script there mate
 
0
•••
Yes, this is a nice way to track bandwidth, hits, size, etc. :)
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back