falarious Posted July 15, 2006 Share Posted July 15, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/14703-i-need-help-with-php/ Share on other sites More sharing options...
akitchin Posted July 15, 2006 Share Posted July 15, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/14703-i-need-help-with-php/#findComment-58656 Share on other sites More sharing options...
falarious Posted July 16, 2006 Author Share Posted July 16, 2006 Would it be possible to do this?[code]<img src="showimage.php?image=image1">[/code]Where image1 is hidden.gif Quote Link to comment https://forums.phpfreaks.com/topic/14703-i-need-help-with-php/#findComment-58751 Share on other sites More sharing options...
akitchin Posted July 16, 2006 Share Posted July 16, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/14703-i-need-help-with-php/#findComment-58754 Share on other sites More sharing options...
Prismatic Posted July 16, 2006 Share Posted July 16, 2006 Wont stop anyone from right clicking and saving Quote Link to comment https://forums.phpfreaks.com/topic/14703-i-need-help-with-php/#findComment-58755 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.