Hope someone can help me....
I'm using the following code to build an array of specific tags, once complete this array is json_encoded and returned to my app.
Code: Select all
elseif(is_readable("$dir$entry")) {
$trackInfo = $getID3->analyze("$dir$entry");
if(!empty($trackInfo["comments"]["picture"][0]['data'])){
$encoded = base64_encode($trackInfo["comments"]["picture"][0]['data']);
//echo $encoded;
}
$retval[] = array(
"track" => array(
"filepath" => $trackInfo["filepath"],
"filename" => $trackInfo["filename"],
"filenamepath" => $trackInfo["filenamepath"],
"tags_html" => $trackInfo["tags_html"],
"playtime_string" => $trackInfo["playtime_string"],
"picturedata" => (!empty($trackInfo["comments"]["picture"])) ? $encoded : null,
"mimetype" => (!empty($trackInfo["comments"]["picture"])) ? $trackInfo["comments"]["picture"][0]['image_mime'] : null
)
);
}
}
$d->close();
return $retval;
}
$dirlist = getFileList("music", true);
Code: Select all
echo ")]}',\n" . json_encode($dirlist);
How can I get picture binary data as a json_encoded element?
Thanks in advance