public function GenerateCONTchunk() { foreach ($this->tag_data as $key => $value) { // limit each value to 0xFFFF bytes $this->tag_data[$key] = substr($value, 0, 65535); } $CONTchunk = ""; // object version $CONTchunk .= Utils::BigEndian2String(!empty($this->tag_data['title']) ? strlen($this->tag_data['title']) : 0, 2); $CONTchunk .= !empty($this->tag_data['title']) ? strlen($this->tag_data['title']) : ''; $CONTchunk .= Utils::BigEndian2String(!empty($this->tag_data['artist']) ? strlen($this->tag_data['artist']) : 0, 2); $CONTchunk .= !empty($this->tag_data['artist']) ? strlen($this->tag_data['artist']) : ''; $CONTchunk .= Utils::BigEndian2String(!empty($this->tag_data['copyright']) ? strlen($this->tag_data['copyright']) : 0, 2); $CONTchunk .= !empty($this->tag_data['copyright']) ? strlen($this->tag_data['copyright']) : ''; $CONTchunk .= Utils::BigEndian2String(!empty($this->tag_data['comment']) ? strlen($this->tag_data['comment']) : 0, 2); $CONTchunk .= !empty($this->tag_data['comment']) ? strlen($this->tag_data['comment']) : ''; if ($this->paddedlength > strlen($CONTchunk) + 8) { $CONTchunk .= str_repeat("", $this->paddedlength - strlen($CONTchunk) - 8); } $CONTchunk = 'CONT' . Utils::BigEndian2String(strlen($CONTchunk) + 8, 4) . $CONTchunk; // CONT chunk identifier + chunk length return $CONTchunk; }