469,649 Members | 1,301 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,649 developers. It's quick & easy.

calling image <img src=" .php" hiding img src

FX
I wanna publish a script on my site which allows me to hide image
source.
i have rough idea abt it. i`ll point src to some php page like:
<img src="image.php">
& in tht php wat exactly shud be done so tht user doesnt come to know
the real source location of image file upon clicking its properties.
I've seen websites doing this. can somebody post the script for it?

Thanx in advance

Nov 28 '05 #1
10 30871
FX wrote:
<img src="image.php">
I've seen websites doing this. can somebody post the script for it?


http://php.net/imagejpeg

--
E. Dronkert
Nov 28 '05 #2
"FX" wrote:
I wanna publish a script on my site which allows me to hide image
source.
Just don't publish your images. Works every time.
i have rough idea abt it. i`ll point src to some php page like:
<img src="image.php">
& in tht php wat exactly shud be done so tht user doesnt come to know
the real source location of image file upon clicking its properties.
Are you posting from a mobile phone? Please turn on the predictive texting
function so we can see whole words instead of this giberish.

In answer to your question, the script at "image.php" will either have to
supply the image source itself, or redirect the user's browser to the actual
location of the image. Either way you're not hiding anything.

Think about it. How the hell is your browser supposed to display an image
without being able to see the source code of the image?
I've seen websites doing this.


No you haven't.

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/

Nov 28 '05 #3
FX
come on i can bet, i`ve seen these.
<?php
header("Content-Type: image/jpeg");
imagejpeg($image,'',100); // Output to Browser
?>
when u save files it displays image.php rather than imagge.jpg
although it knows jpg src

Nov 28 '05 #4
Following on from Philip Ronan's message. . .
In answer to your question, the script at "image.php" will either have to
supply the image source itself, or redirect the user's browser to the actual
location of the image. Either way you're not hiding anything.

Think about it. How the hell is your browser supposed to display an image
without being able to see the source code of the image?

Crct.

Wht the OP mns (is hard to tell, but possibly) not shw orignl URL

Hiding hot-linking to 3rd party sites. Umm...

--
PETER FOX Not the same since the porcelain business went down the pan
pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Nov 28 '05 #5
FX wrote:
come on i can bet, i`ve seen these.
<?php
header("Content-Type: image/jpeg");
imagejpeg($image,'',100); // Output to Browser
?>
when u save files it displays image.php rather than imagge.jpg
although it knows jpg src


So? All I have to do is load image.php instead of image.jpg. Nothing
hidden other than the physical location of the jpeg.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 28 '05 #6
FX wrote:
I wanna publish a script on my site which allows me to hide image
source.
i have rough idea abt it. i`ll point src to some php page like:
<img src="image.php">
& in tht php wat exactly shud be done so tht user doesnt come to know
the real source location of image file upon clicking its properties.
I've seen websites doing this. can somebody post the script for it?


Are you trying to prevent hotlinking? If so then you are better off
looking at adding lines to a .htaccess file (if using Apache). Because
linking to images through a script like this won't achieve anything
other than change the URL, people can still hotlink to it.
Nov 28 '05 #7
>I wanna publish a script on my site which allows me to hide image
source.
i have rough idea abt it. i`ll point src to some php page like:
<img src="image.php">
& in tht php wat exactly shud be done so tht user doesnt come to know
the real source location of image file upon clicking its properties.
I've seen websites doing this. can somebody post the script for it?


If you want to display an image, the browser has to have a way of
getting it. Unfortunately, this means that the browser has a way
of getting it, which you don't seem to want.

It is possible to have a PHP script return an image. This does
*NOT* hide the location of the image (from the point of view of the
browser, the script *is* an image, and it can fetch it using that
URL), but it does allow the PHP to check whether the user is logged
in and authorized to access it before sending it. A PHP page could,
for example, after checking that the user is logged in, call
header("Content-type: image/jpeg"), fopen() a .jpeg file outside
the document tree, and feed it to fpassthru() to send it on to the
browser. Don't add any text; it will mess up the image.

There is still a URL the browser can use to fetch the image: your
PHP script. But you get to check for a valid login.

Gordon L. Burditt
Nov 28 '05 #8
Nick wrote:
linking to images through a script like this won't achieve anything
other than change the URL, people can still hotlink to it.


Unless you check things like the referrer or sessionID in the script.
Obviously not 100% watertight but often enough.

--
E. Dronkert
Nov 28 '05 #9
If you do something like :

header('Content-type: image/jpeg');
header('Content-Length: ' . filesize($imgFile));
$pipe = fopen($imgFile, 'rb');
fpassthru($pipe);
fclose($pipe);

I think the location will be hidden.
But not source (the binary data).

Nov 28 '05 #10
FX
ok let me further clear my purpose. I just want to add image as <img
src="image.php"/> and when somebody copies its location (image
location) the src address displayed is image.php rather than image.jpg.
i dont want image to bre hidden. i just want tht when image is right
clicked > copy in IE, then pasted somewhere, it takes location as
image.php
Wat shud be the code inside image.php ?

Nov 30 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by McKirahan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.