Reputation: 25
i have a based 64 image uri and decoding it ,but the issue is, i dont know how to apply php image filter function, how do i make the image filter function access the image data and later upload the filtered image to mysql database. Though i'v tried using imagecreatefromstring
,i think i'm doing it wrong. I'd be glad if i can get any advice.
Thanks
$code_base64="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABk........
`
$base_to_php = explode(',', $baseFromJavascript);
$data = base64_decode($base_to_php);
Upvotes: 0
Views: 182
Reputation: 290
The explode() method returns an array and the base64_decode() method expects a string, so that is one thing you could look into.
I think it should be this?
if( isset($base_to_php[1]) && ! empty($base_to_php[1]) )
{
$data = base64_decode($base_to_php[1]);
}
... depending how many comma's there are in this $code_base64 string to begin with, of course
Upvotes: 1