Jump to content

Archived

This topic is now archived and is closed to further replies.

falarious

I need help with PHP

Recommended Posts

Is it possible to hide a small piece of html code with php?
Its just an image that I dont want other people getting. Is it possible to take it off the source code when someone right clicks and views source?

Share this post


Link to post
Share on other sites
it isn't possible to hide the source code itself, but you can use a PHP file as the source itself.

[code]<img src="showImage.php?image=hidden.gif" />[/code]

showImage.php would look something like this:

[code]<?php
$filename = $_GET['image'];
$handle = fopen($filename, "r");
$image_resource = fread($handle, filesize($handle));
fclose($handle);
echo $image_resource;
?>[/code]

keep in mind that you may need to change the path, add error checking, etc.  but that should accomplish (minimally) what you're after.

Share this post


Link to post
Share on other sites
Would it be possible to do this?

[code]
<img src="showimage.php?image=image1">
[/code]

Where image1 is hidden.gif

Share this post


Link to post
Share on other sites
if you dont want them to see the filename, simply put it locally in the showImage.php, like so:

[code]<img src="showImage.php" />[/code]

and change the line in showImage.php to:

[code]$filename = 'hidden.gif';[/code]

it all depends on whether you have multiple images you want to hide.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.