waleed22's avatar

returning image with multiple fields in postman

i am creating api in which image is uploaded with fields Bio and Url to the databse using postman.when i try to retrieve the data it hit this error

InvalidArgumentException: Malformed UTF-8 characters, possibly incorrectly encoded in file

here is my show method

public function show($id) {

$image = Images::findOrFail($id);

    $image_file = Image::make($image->user_image);

    $response = Response::make($image_file->encode('jpeg'))->header('Content-Type', 'image/jpeg');

    $image_bio=$image->Bio;

    $image_url=$image->Url;

    return Response::json(array(

        'user_image' => $response,

        'Bio' => $image_bio,

        'Url' => $image_url,

    ));

}
0 likes
2 replies
waleed22's avatar

if i write like this

return $response;

return $ $image_bio;

return $image_url;

it only execute the first return statement

Please or to participate in this conversation.