当前位置: 首页>>代码示例>>PHP>>正文


PHP Art::gather方法代码示例

本文整理汇总了PHP中Art::gather方法的典型用法代码示例。如果您正苦于以下问题:PHP Art::gather方法的具体用法?PHP Art::gather怎么用?PHP Art::gather使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Art的用法示例。


在下文中一共展示了Art::gather方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 $keyword = '';
 $options = array();
 foreach ($keywords as $key => $word) {
     if (isset($_REQUEST['option_' . $key])) {
         $word['value'] = $_REQUEST['option_' . $key];
     }
     $options[$key] = $word['value'];
     if ($word['important']) {
         if (!empty($word['value'])) {
             $keyword .= ' ' . $word['value'];
         }
     }
 }
 $options['keyword'] = trim($keyword);
 // Attempt to find the art.
 $images = $art->gather($options);
 if (!empty($_REQUEST['cover'])) {
     $path_info = pathinfo($_REQUEST['cover']);
     $cover_url[0]['url'] = scrub_in($_REQUEST['cover']);
     $cover_url[0]['mime'] = 'image/' . $path_info['extension'];
 }
 $images = array_merge($cover_url, $images);
 // If we've found anything then go for it!
 if (count($images)) {
     // We don't want to store raw's in here so we need to strip them out into a separate array
     foreach ($images as $index => $image) {
         if ($image['raw']) {
             unset($images[$index]['raw']);
         }
     }
     // end foreach
开发者ID:nioc,项目名称:ampache,代码行数:31,代码来源:arts.php

示例2: gather_art

 /**
  * gather_art
  *
  * This runs through all of the albums and finds art for them
  * This runs through all of the needs art albums and trys
  * to find the art for them from the mp3s
  */
 public function gather_art()
 {
     // Make sure they've actually got methods
     $art_order = AmpConfig::get('art_order');
     if (!count($art_order)) {
         debug_event('gather_art', 'art_order not set, Catalog::gather_art aborting', 3);
         return true;
     }
     // Prevent the script from timing out
     set_time_limit(0);
     $search_count = 0;
     $albums = $this->get_album_ids();
     // Run through them and get the art!
     foreach ($albums as $album_id) {
         $art = new Art($album_id, 'album');
         $album = new Album($album_id);
         // We're going to need the name here
         $album->format();
         debug_event('gather_art', 'Gathering art for ' . $album->name, 5);
         $options = array('album_name' => $album->full_name, 'artist' => $album->artist_name, 'keyword' => $album->artist_name . ' ' . $album->full_name);
         $results = $art->gather($options, 1);
         if (count($results)) {
             // Pull the string representation from the source
             $image = Art::get_from_source($results[0], 'album');
             if (strlen($image) > '5') {
                 $art->insert($image, $results[0]['mime']);
                 // If they've enabled resizing of images generate a thumbnail
                 if (AmpConfig::get('resize_images')) {
                     $thumb = $art->generate_thumb($image, array('width' => 275, 'height' => 275), $results[0]['mime']);
                     if (is_array($thumb)) {
                         $art->save_thumb($thumb['thumb'], $thumb['thumb_mime'], '275x275');
                     }
                 }
             } else {
                 debug_event('gather_art', 'Image less than 5 chars, not inserting', 3);
             }
         }
         // Stupid little cutesie thing
         $search_count++;
         if (UI::check_ticker()) {
             UI::update_text('count_art_' . $this->id, $search_count);
             UI::update_text('read_art_' . $this->id, scrub_out($album->name));
         }
         unset($found);
     }
     // foreach albums
     // One last time for good measure
     UI::update_text('count_art_' . $this->id, $search_count);
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:56,代码来源:catalog.class.php

示例3: T_

 *
 */
$web_path = AmpConfig::get('web_path');
// Title for this album
$title = scrub_out($walbum->name) . ' (' . $walbum->year . ')';
$title .= ' - ' . $walbum->f_artist_link;
UI::show_box_top($title, 'info-box missing');
?>
<div class="item_art">
<?php 
// Attempt to find the art.
$art = new Art($walbum->mbid, 'album');
$options['artist'] = $artist->name;
$options['album_name'] = $walbum->name;
$options['keyword'] = $artist->name . " " . $walbum->name;
$images = $art->gather($options, '1');
if (count($images) > 0 && !empty($images[0]['url'])) {
    $name = '[' . $artist->name . '] ' . scrub_out($walbum->name);
    $image = $images[0]['url'];
    echo "<a href=\"" . $image . "\" rel=\"prettyPhoto\">";
    echo "<img src=\"" . $image . "\" alt=\"" . $name . "\" alt=\"" . $name . "\" height=\"128\" width=\"128\" />";
    echo "</a>\n";
}
?>
</div>
<div id="information_actions">
<h3><?php 
echo T_('Actions');
?>
:</h3>
<ul>
开发者ID:nioc,项目名称:ampache,代码行数:31,代码来源:show_missing_album.inc.php

示例4: gather_art_item

 /**
  *
  * @param string $type
  * @param int $id
  */
 public function gather_art_item($type, $id)
 {
     debug_event('gather_art', 'Gathering art for ' . $type . '/' . $id . '...', 5);
     // Should be more generic !
     if ($type == 'video') {
         $libitem = Video::create_from_id($id);
     } else {
         $libitem = new $type($id);
     }
     $options = array();
     $libitem->format();
     if ($libitem->id) {
         if (count($options) == 0) {
             // Only search on items with default art kind as `default`.
             if ($libitem->get_default_art_kind() == 'default') {
                 $keywords = $libitem->get_keywords();
                 $keyword = '';
                 foreach ($keywords as $key => $word) {
                     $options[$key] = $word['value'];
                     if ($word['important']) {
                         if (!empty($word['value'])) {
                             $keyword .= ' ' . $word['value'];
                         }
                     }
                 }
                 $options['keyword'] = $keyword;
             }
             $parent = $libitem->get_parent();
             if ($parent != null) {
                 if (!Art::has_db($parent['object_id'], $parent['object_type'])) {
                     $this->gather_art_item($parent['object_type'], $parent['object_id']);
                 }
             }
         }
     }
     $art = new Art($id, $type);
     $results = $art->gather($options, 1);
     if (count($results)) {
         // Pull the string representation from the source
         $image = Art::get_from_source($results[0], $type);
         if (strlen($image) > '5') {
             $art->insert($image, $results[0]['mime']);
             // If they've enabled resizing of images generate a thumbnail
             if (AmpConfig::get('resize_images')) {
                 $size = array('width' => 275, 'height' => 275);
                 $thumb = $art->generate_thumb($image, $size, $results[0]['mime']);
                 if (is_array($thumb)) {
                     $art->save_thumb($thumb['thumb'], $thumb['thumb_mime'], $size);
                 }
             }
         } else {
             debug_event('gather_art', 'Image less than 5 chars, not inserting', 3);
         }
     }
     if ($type == 'video' && AmpConfig::get('generate_video_preview')) {
         Video::generate_preview($id);
     }
     if (UI::check_ticker()) {
         UI::update_text('read_art_' . $this->id, $libitem->get_fullname());
     }
 }
开发者ID:bl00m,项目名称:ampache,代码行数:66,代码来源:catalog.class.php


注:本文中的Art::gather方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。