/** * @see GalleryResizer::generate */ function generate($outFile, $width, $height) { // // generate the thubmanil but check for errors every time // // also, check if GD is available because otherwise we would get // all sorts of nasty errors... if (!GdDetector::detectGd()) { return false; } if (!$this->thumbnail($this->_image)) { return false; } if ($this->img["lebar"] < $width || $this->img["tinggi"] < $height) { $this->img["lebar_thumb"] = $this->img["lebar"]; $this->img["tinggi_thumb"] = $this->img["tinggi"]; } else { $this->size_height($height); $this->size_width($width); } if (!$this->save($outFile)) { return false; } return $outFile; }
function perform() { // retrieve the values from the view $this->_blogName = $this->_request->getValue("blogName"); $this->_ownerId = $this->_request->getValue("ownerid"); $this->_blogProperties = $this->_request->getValue("properties"); $this->_blogTemplate = $this->_request->getValue("blogTemplate"); $this->_blogLocale = $this->_request->getValue("blogLocale"); // configure the blog $blogs = new Blogs(); $blog = new BlogInfo($this->_blogName, $this->_ownerId, "", ""); $blog->setProperties($this->_blogProperties); $blog->setStatus(BLOG_STATUS_ACTIVE); $blogSettings = $blog->getSettings(); $blogSettings->setValue("locale", $this->_blogLocale); $blogSettings->setValue("template", $this->_blogTemplate); $blog->setSettings($blogSettings); // and now save it to the database $newblogId = $blogs->addBlog($blog); if (!$newblogId) { $this->_view = new WizardView("step4"); $this->_view->setValue("siteLocales", Locales::getLocales()); $ts = new TemplateSets(); $this->_view->setValue("siteTemplates", $ts->getGlobalTemplateSets()); $this->_view->setErrorMessage("There was an error creating the new blog"); $this->setCommonData(true); return false; } // if the blog was created, we can add some basic information // add a category $articleCategories = new ArticleCategories(); $articleCategory = new ArticleCategory("General", "", $newblogId, true); $catId = $articleCategories->addArticleCategory($articleCategory); // load the right locale $locale =& Locales::getLocale($this->_blogLocale); // and load the right text $articleTopic = $locale->tr("register_default_article_topic"); $articleText = $locale->tr("register_default_article_text"); $article = new Article($articleTopic, $articleText, array($catId), $this->_ownerId, $newblogId, POST_STATUS_PUBLISHED, 0, array(), "welcome"); $t = new Timestamp(); $article->setDateObject($t); $articles = new Articles(); $articles->addArticle($article); // save a few things in the default configuration $config =& Config::getConfig(); // default blog id $config->saveValue("default_blog_id", (int) $newblogId); // default locale $config->saveValue("default_locale", $this->_blogLocale); // and finally, the default template $config->saveValue("default_template", $this->_blogTemplate); // // detect wether we have GD available and set the blog to use it // if (GdDetector::detectGd()) { $config->saveValue("thumbnail_method", "gd"); $message = "GD has been detected and set as the backend for dealing with images."; } else { $pathToConvert = $config->getValue("path_to_convert"); if ($pathToConvert) { $config->saveValue("thumbnail_method", "imagemagick"); $message = "ImageMagick has been detected and set as the backend for dealing with images."; } else { // nothing was found, so we'll have to do away with the 'null' resizer... $config->saveValue("thumbnail_method", "null"); $message = "Neither GD nor ImageMagick have been detected in this host so it will not be possible to generate thumbnails from images."; } } $this->_view = new WizardView("step5"); $this->_view->setValue("message", $message); return true; }