cover wont show! Why?

Locked
pmaonline
User
Posts:3
Joined:Mon Dec 07, 2009 5:23 pm
Are you a spambot?:no
cover wont show! Why?

Post by pmaonline » Wed Dec 09, 2009 7:22 pm

Hi i have this code to insert the cover:

$img_desc = "Image Description";
$cover = "img.jpg";

$TagData['attached_picture'][]=array(
'picturetypeid'=>3,
'description'=>$image_description,
'mime'=>'image/jpeg',
'data'=>$cover // Image data
);


in array is:

[APIC] => Array
(
[0] => Array
(
[frame_name] => APIC
[frame_flags_raw] => 0
[data] => img.jpg
[datalength] => 21
[dataoffset] => 452
[framenamelong] => Attached picture
[framenameshort] => attached_picture
[flags] => Array
(
[TagAlterPreservation] =>
[FileAlterPreservation] =>
[ReadOnly] =>
[compression] =>
[Encryption] =>
[GroupingIdentity] =>
)

[encodingid] => 0
[encoding] => ISO-8859-1
[mime] => image/jpeg
[picturetypeid] => 3
[picturetype] => Cover (front)
[description] => Image Description
)

)


And when i read the mp3 file in media player or winamp the image is not there, can someone help me please?

Thanks

pmaonline
User
Posts:3
Joined:Mon Dec 07, 2009 5:23 pm
Are you a spambot?:no

Re: cover wont show! Why?

Post by pmaonline » Sun Dec 13, 2009 1:44 pm

Solved:

Code: Select all

$cover = "bg.jpg";

list($APIC_width, $APIC_height, $APIC_imageTypeID) = GetImageSize($cover);
$fd = @fopen($capa, 'rb');
$img = fread($fd, filesize($capa));
fclose ($fd);

$TagData['attached_picture'][0]['data']          = $img;
$TagData['attached_picture'][0]['picturetypeid'] = '3';
$TagData['attached_picture'][0]['description']   = "description";
$TagData['attached_picture'][0]['mime']          = 'image/jpeg';

$tagwriter->tag_data = $TagData;

if ($tagwriter->WriteTags()) {
	echo 'OK<br>';
	if (!empty($tagwriter->warnings)) {
		echo 'Error:<br>'.implode('<br><br>', $tagwriter->warnings);
	}
} else {
	echo 'Error!<br>'.implode('<br><br>', $tagwriter->errors);
}

Locked