How to hide images URL with PHP and Ajax

July 16th, 2014 by
You can hide images url with php and ajax:
HTML:
<img id="image_id" src="" alt="" /> 
PHP File:
<?php
header('Content-Type: image/jpeg');
readfile('pathtoimage.jpg'); 
 ?>
Javascrip jQuery:
<script type="text/javascript">
	jQuery( document ).ready(function() {
jQuery('#image_id').attr('src', 'pathtophpfile.php'); });
</script>

Post a Comment

You must be logged in to post a comment.

Cached at: 2024-04-26 09:30:35am