Reputation: 869
I want to hide the source of image tag. When someone view the page source or try to view through firebug I dont want to show them the source of image. Is it possible in php and how?
My view code
<?php foreach($titles_data as $title){ ?>
<li class="flag_<?php echo strtoupper($title['language']) ?>">
<a href="" title="<?php echo $title['title'] ?>">
<img src="hidden"<?php echo $title['image_path']?>" height="95" width="75" alt="" />
</a>
</li>
<?php } ?>
I want the src of image to be hidden from users Any idea ?
Thanks in advance
Upvotes: 1
Views: 1114
Reputation: 2286
Well, you can encode your image to Base64 and serve that as the image source. That will prevent users from finding out where the image is located on your server.
I don't recommend you do this.
Upvotes: 0
Reputation: 57656
No, it's not possible.
You can set them dynamically with JS, but you can't hide them. You can store them as base64 encoded strings, and then decode them on the fly which will "hide" them from your page's source.
However, this is still utterly pointless as in the end, the browser still makes an HTTP request to fetch the image.
Upvotes: 1
Reputation: 24549
If you hide the source from the users, it hides it from the browser as well. Then your image will not be able to display.
Instead you should consider solutions such as htaccess rules to your image folders.
Upvotes: 1