Jump to content


Photo

I need help with PHP


  • Please log in to reply
4 replies to this topic

#1 falarious

falarious
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 15 July 2006 - 08:43 PM

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?

#2 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 15 July 2006 - 08:53 PM

it isn't possible to hide the source code itself, but you can use a PHP file as the source itself.

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

showImage.php would look something like this:

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

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

#3 falarious

falarious
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 16 July 2006 - 01:45 AM

Would it be possible to do this?

<img src="showimage.php?image=image1">

Where image1 is hidden.gif



#4 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 16 July 2006 - 01:53 AM

if you dont want them to see the filename, simply put it locally in the showImage.php, like so:

<img src="showImage.php" />

and change the line in showImage.php to:

$filename = 'hidden.gif';

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

#5 Prismatic

Prismatic
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 16 July 2006 - 01:55 AM

Wont stop anyone from right clicking and saving




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users