how to render a php page as a png image using data uri -
i've data uri of png image, i've stored data uri in mysql data base. lets img.php file returns png image
<?php $id=$_get['id]; //data base connection , mysql queries $data = "data:image/png;base64,ivborw0kggoaaaansuheugaaaoaaaadmcayaaabqq6+saaaen0leqvr4xu3tuqkaibafqc1ihsoaumes+znx4mfwo9fzdzgcbbkbkcde3siblybaj0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+agad9aifqqiahvmkcavqdbeibayb4pgki0a8qcauegokbjibap0agfbbgig+awanjn7jcdjyveqaaaabjru5erkjggg=="; //$data obtained mysql database header('content-type: image/png'); $im = imagecreatefromstring($data); imagepng($im); imagedestroy($im); ?>
i've tried above code, not giving me output, please help. in advance.
the code pointless. have png inside data uri, there zero point in loading png gd, re-compressing png. that's massive waste of ram , cpu time accomplish nothing.
also, gd doesn't understand data uris, cannot feed uri gd functions , expect useful happen.
you have png, need this:
$b64_png = string_operation_to_extract_base64_data_from_data_uri($datauri); header('content-type: image/png'); echo base64_decode($b64_png);
Comments
Post a Comment