Image convert into Data using php

by Prabakaran 2012-10-18 13:12:34

<?php
$image = 'test.jpg';


// Read image path, convert to base64 encoding
$imageData = base64_encode(file_get_contents($image));

// Format the image SRC: data:{mime};base64,{data};
$src = 'data: '.mime_content_type($image).';base64,'.$imageData;

// Echo out a sample image
echo '<img src="',$src,'">';

?>
582
like
0
dislike
0
mail
flag

You must LOGIN to add comments