本文整理汇总了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.");
}
}
}