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


PHP Errors::showImageMessage方法代码示例

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


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

示例1: generate

 /**
  * Generate the picture and ouput it.
  * The second request will use the pregenerated version.
  */
 public function generate()
 {
     if (!isset($this->user) || !isset($this->type) || !isset($this->color) || !isset($this->imgGen)) {
         throw new Exception("Missing some informations " . "(user, type, color or image generator).");
     }
     $db = Config::$dbInstance;
     $sql = "SELECT * " . "FROM lastfm_images_cache_blob " . "WHERE user = ? AND nb_artists = ? AND type = ? AND color = ? AND layout = ?";
     $values = array($this->user, $this->nbArtists, $this->type, $this->color, $this->layout);
     $it = $db->execQueryIterator($sql, $values);
     if ($line = $it->getNext()) {
         //Already in cache
         $this->result = $line['image'];
     } else {
         //First request : generate picture and store it in db
         //Check if the maximum number of generations is reach
         $sql = "SELECT count(idimage) as nbgen " . "FROM lastfm_images_cache_blob " . "WHERE user = ?";
         $values = array($this->user);
         $it = $db->execQueryIterator($sql, $values);
         if ($line = $it->getNext()) {
             if ($line['nbgen'] >= Config::NB_GENERATION_ALLOW) {
                 Errors::showImageMessage("You have already generate " . $line['nbgen'] . " banners." . " Wait for the next update to try a different layout.");
                 return;
             }
         }
         //
         $crawler = new CrawlerLastFM();
         $artists = $crawler->getListTopArtists($this->user, $this->type);
         if (count($artists) > 0) {
             $this->imgGen->setArtists($artists);
             $this->imgGen->setNbArtists($this->nbArtists);
             $this->imgGen->setColor($this->color);
             ob_start(array(&$this, 'cacheImage'));
             $this->imgGen->show();
             ob_end_flush();
         } else {
             //An invalid/block/empty account
             throw new Exception("No artist found.");
         }
     }
 }
开发者ID:h3xstream,项目名称:bandlogos,代码行数:44,代码来源:DatabaseCache.class.php


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