本文整理汇总了PHP中Art::get_thumb方法的典型用法代码示例。如果您正苦于以下问题:PHP Art::get_thumb方法的具体用法?PHP Art::get_thumb怎么用?PHP Art::get_thumb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Art
的用法示例。
在下文中一共展示了Art::get_thumb方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getcoverart
/**
* getCoverArt
* Get a cover art image.
* Takes the cover art id in parameter.
*/
public static function getcoverart($input)
{
self::check_version($input, "1.0.0", true);
$id = self::check_parameter($input, 'id', true);
$size = $input['size'];
$art = null;
if (Subsonic_XML_Data::isArtist($id)) {
$art = new Art(Subsonic_XML_Data::getAmpacheId($id), "artist");
} elseif (Subsonic_XML_Data::isAlbum($id)) {
$art = new Art(Subsonic_XML_Data::getAmpacheId($id), "album");
} elseif (Subsonic_XML_Data::isSong($id)) {
$art = new Art(Subsonic_XML_Data::getAmpacheId($id), "song");
if ($art != null && $art->id == null) {
// in most cases the song doesn't have a picture, but the album where it belongs to has
// if this is the case, we take the album art
$song = new Song(Subsonic_XML_Data::getAmpacheId(Subsonic_XML_Data::getAmpacheId($id)));
$art = new Art(Subsonic_XML_Data::getAmpacheId($song->album), "album");
}
} elseif (Subsonic_XML_Data::isPodcast($id)) {
$art = new Art(Subsonic_XML_Data::getAmpacheId($id), "podcast");
}
header("Access-Control-Allow-Origin: *");
if ($art != null) {
$art->get_db();
if ($size && AmpConfig::get('resize_images')) {
$dim = array();
$dim['width'] = $size;
$dim['height'] = $size;
$thumb = $art->get_thumb($dim);
if ($thumb) {
header('Content-type: ' . $thumb['thumb_mime']);
header('Content-Length: ' . strlen($thumb['thumb']));
echo $thumb['thumb'];
return;
}
}
header('Content-type: ' . $art->raw_mime);
header('Content-Length: ' . strlen($art->raw));
echo $art->raw;
}
}
示例2: switch
switch ($type) {
case 'video':
case 'tvshow':
case 'tvshow_season':
$mime = 'image/png';
$defaultimg .= "blankmovie.png";
break;
default:
$mime = 'image/png';
$defaultimg .= "blankalbum.png";
break;
}
$image = file_get_contents($defaultimg);
} else {
if ($_GET['thumb']) {
$thumb_data = $art->get_thumb($size);
$etag .= '-' . $_GET['thumb'];
}
$mime = isset($thumb_data['thumb_mime']) ? $thumb_data['thumb_mime'] : $art->raw_mime;
$image = isset($thumb_data['thumb']) ? $thumb_data['thumb'] : $art->raw;
}
}
if (!empty($image)) {
$extension = Art::extension($mime);
$filename = scrub_out($filename . '.' . $extension);
// Send the headers and output the image
$browser = new Horde_Browser();
if (!empty($etag)) {
header('ETag: ' . $etag);
header('Cache-Control: private');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time()));
示例3: getcoverart
/**
* getCoverArt
* Get a cover art image.
* Takes the cover art id in parameter.
*/
public static function getcoverart($input)
{
self::check_version($input, "1.0.0", true);
$id = self::check_parameter($input, 'id', true);
$size = $input['size'];
$art = null;
if (Subsonic_XML_Data::isArtist($id)) {
$art = new Art(Subsonic_XML_Data::getAmpacheId($id), "artist");
} else {
if (Subsonic_XML_Data::isAlbum($id)) {
$art = new Art(Subsonic_XML_Data::getAmpacheId($id), "album");
} else {
if (Subsonic_XML_Data::isSong($id)) {
$art = new Art(Subsonic_XML_Data::getAmpacheId($id), "song");
}
}
}
if ($art != null) {
$art->get_db();
if ($size) {
$dim = array();
$dim['width'] = $size;
$dim['height'] = $size;
$thumb = $art->get_thumb($dim);
if ($thumb) {
header('Content-type: ' . $thumb['thumb_mime']);
header('Content-Length: ' . strlen($thumb['thumb']));
echo $thumb['thumb'];
return;
}
}
header('Content-type: ' . $art->raw_mime);
header('Content-Length: ' . strlen($art->raw));
echo $art->raw;
}
}
示例4: library_metadata
//.........这里部分代码省略.........
$litem->format();
Plex_XML_Data::setArtistRoot($r, $litem);
} else {
if (Plex_XML_Data::isAlbum($key)) {
$litem = new Album($id);
$litem->format();
Plex_XML_Data::setAlbumRoot($r, $litem);
} else {
if (Plex_XML_Data::isTVShow($key)) {
$litem = new TVShow($id);
$litem->format();
Plex_XML_Data::setTVShowRoot($r, $litem);
} else {
if (Plex_XML_Data::isTVShowSeason($key)) {
$litem = new TVShow_Season($id);
$litem->format();
Plex_XML_Data::setTVShowSeasonRoot($r, $litem);
}
}
}
}
} elseif ($subact == "thumbs" || $subact == "posters" || $subact == "arts" || $subact == 'backgrounds') {
$kind = Plex_XML_Data::getPhotoKind($subact);
if ($createMode) {
// Upload art
$litem = Plex_XML_Data::createLibraryItem($key);
if ($litem != null) {
$uri = Plex_XML_Data::getMetadataUri($key) . '/' . Plex_XML_Data::getPhotoPlexKind($kind) . '/' . $key;
if (is_a($litem, 'video')) {
$type = 'video';
} else {
$type = get_class($litem);
}
$art = new Art($litem->id, $type, $kind);
$raw = file_get_contents("php://input");
$art->insert($raw);
header('Content-Type: text/html');
echo $uri;
exit;
}
}
Plex_XML_Data::addPhotos($r, $key, $kind);
} elseif ($subact == "thumb" || $subact == "poster" || $subact == "art" || $subact == "background") {
if ($n == 3) {
$kind = Plex_XML_Data::getPhotoKind($subact);
// Ignore art id as we can only have 1 thumb
$art = null;
if (Plex_XML_Data::isArtist($key)) {
$art = new Art($id, "artist", $kind);
} else {
if (Plex_XML_Data::isAlbum($key)) {
$art = new Art($id, "album", $kind);
} else {
if (Plex_XML_Data::isTrack($key)) {
$art = new Art($id, "song", $kind);
} else {
if (Plex_XML_Data::isTVShow($key)) {
$art = new Art($id, "tvshow", $kind);
} else {
if (Plex_XML_Data::isTVShowSeason($key)) {
$art = new Art($id, "tvshow_season", $kind);
} else {
if (Plex_XML_Data::isVideo($key)) {
$art = new Art($id, "video", $kind);
}
}
}
}
}
}
if ($art != null) {
$art->get_db();
ob_clean();
if (!isset($size)) {
self::setHeader($art->raw_mime);
echo $art->raw;
} else {
$dim = array();
$dim['width'] = $size;
$dim['height'] = $size;
$thumb = $art->get_thumb($dim);
self::setHeader($art->thumb_mime);
echo $thumb['thumb'];
}
exit;
}
}
}
}
}
if ($litem != null) {
$catalog_ids = $litem->get_catalogs();
if (count($catalog_ids) > 0) {
$catalog = Catalog::create_from_id($catalog_ids[0]);
Plex_XML_Data::addCatalogIdentity($r, $catalog);
}
}
Plex_XML_Data::setContainerSize($r);
self::apiOutputXml($r->asXML());
}
示例5: library_metadata
public static function library_metadata($params)
{
$r = Plex_XML_Data::createLibContainer();
$n = count($params);
if ($n > 0) {
$key = $params[0];
$id = Plex_XML_Data::getAmpacheId($key);
if ($n == 1) {
// Should we check that files still exists here?
$checkFiles = $_REQUEST['checkFiles'];
if (Plex_XML_Data::isArtist($key)) {
$artist = new Artist($id);
$artist->format();
Plex_XML_Data::addArtist($r, $artist);
} elseif (Plex_XML_Data::isAlbum($key)) {
$album = new Album($id);
$album->format();
Plex_XML_Data::addAlbum($r, $album);
} elseif (Plex_XML_Data::isTrack($key)) {
$song = new Song($id);
$song->format();
Plex_XML_Data::addSong($r, $song);
}
} else {
$subact = $params[1];
if ($subact == "children") {
if (Plex_XML_Data::isArtist($key)) {
$artist = new Artist($id);
$artist->format();
Plex_XML_Data::setArtistRoot($r, $artist);
} else {
if (Plex_XML_Data::isAlbum($key)) {
$album = new Album($id);
$album->format();
Plex_XML_Data::setAlbumRoot($r, $album);
}
}
} elseif ($subact == "thumb") {
if ($n == 3) {
// Ignore thumb id as we can only have 1 thumb
$art = null;
if (Plex_XML_Data::isArtist($key)) {
$art = new Art($id, "artist");
} else {
if (Plex_XML_Data::isAlbum($key)) {
$art = new Art($id, "album");
} else {
if (Plex_XML_Data::isTrack($key)) {
$art = new Art($id, "song");
}
}
}
if ($art != null) {
$art->get_db();
if (!isset($size)) {
self::setHeader($art->raw_mime);
echo $art->raw;
} else {
$dim = array();
$dim['width'] = $size;
$dim['height'] = $size;
$thumb = $art->get_thumb($dim);
self::setHeader($art->thumb_mime);
echo $thumb['thumb'];
}
exit;
}
}
}
}
}
Plex_XML_Data::setContainerSize($r);
self::apiOutput($r->asXML());
}