php - sending an image and return it using json? -


im trying send image webservice in php using json, client cnt read image.. when return back!!

<?php  //recieve image  $media = json_decode($_post['media']);  header('content-type: image/jpeg'); $image = imagecreatefromjpeg($media); imagefilter($image,img_filter_grayscale); imagefilter($image,img_filter_colorize,100,50,0); imagejpeg($image, '', 90); imagedestroy($image);  //return image  $response = array(            'image' => $image      );        echo json_encode($response);  ?> 

from code, there i'm doing wrong? thanks!!! :))

the json mime type application/json, can't send image/jpeg.

i think easier send path image, , have javascript make request image.

otherwise, i'm not sure how going recreate on client. date uris recommended base64 encoded, if insist on doing this, please call base64_encode() first on it.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -