Wednesday, October 18, 2017

how can i dispaly mysql blob image inside html using angualrjs

using below php code i am store image in MySQL blob datatype.. now i am getting response like "59e5dfa826ea3.png" in angular.But how can i get this image "59e5dfa826ea3.png" to base64 like this using angular:

data/image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANIAAAAzCAYAAADigVZlAAAQN0lEQVR4nO2dCXQTxxniVBORw0KGgoAAAANSUhEUgAAANIAAAAzCAYAAADigVZlAAAQN0lEQVR4nO2dCXQTxxnHiVBORw0KGgoAAAANSUhEUgAAANIAAAAzCAYAAADigVZlAAAQN0lEQVR4nO2dCXQTxxnH

<?php
     list($type, $xp_signature) = explode(';', $xp_signature);
     list(, $xp_signature)      = explode(',', $xp_signature);

     $data = base64_decode($xp_signature);
     $data = str_replace('data:image/png;base64,', '', $xp_signature);

     $data = str_replace(' ', '+', $data);
     $data = base64_decode($data);
     $file =  uniqid() . '.png';

      $success=file_put_contents($file, $data);

?>
     <img data-ng-src="">

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/10/18/how-can-i-dispaly-mysql-blob-image-inside-html-using-angualrjs/
via @lzomedia #developer #freelance #web #lzomedia.com

No comments:

Post a Comment