/** * @param string full path of source image * @param string name destination file (path is retrieved from rsgConfig) * @return true if successfull, false if error */ function makeThumbImage($source, $name = '') { global $rsgConfig; if ($name == '') { $parts = pathinfo($source); $name = $parts['basename']; } $target = JPATH_THUMB . DS . imgUtils::getImgNameThumb($name); if ($rsgConfig->get('thumb_style') == 1 && $rsgConfig->get('graphicsLib') == 'gd2') { return GD2::createSquareThumb($source, $target, $rsgConfig->get('thumb_width')); } else { return imgUtils::resizeImage($source, $target, $rsgConfig->get('thumb_width')); } }
/** * Reads the content of the source directory and creates images in the specified directory * !!!!!!!!!!!!!!!! OBSOLETE, WILL BE REMOVED SHORTLY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * @param string Source directory * @param string Type of image (display, thumbs) * @todo Do a check on allowed filetypes, so only gif, jpeg and png are fed to the image convertor */ function createImages($dir, $type = "display") { global $rsgConfig; /** * Set timelimit to avoid time out errors due to restrictions * in php.ini's 'max_execution_time' which defaults to 30 in * most installations. */ switch ($type) { case "thumbs": $tdir = $this->dirThumbs; $width = $rsgConfig->get("thumb_width"); break; default: case "display": $tdir = $this->dirDisplay; $width = $rsgConfig->get("image_width"); break; } set_time_limit(120); $count = 0; if (is_dir($dir)) { if ($handle = opendir($dir)) { while (($filename = readdir($handle)) !== false) { if (!is_dir($dir . $filename) && $filename !== "." && $filename !== ".." && $filename !== "Thumbs.db") { if (imgUtils::resizeImage($dir . "/" . $filename, JPATH_SITE . $this->dirDisplay . "/" . $filename, $rsgConfig->get('image_width'))) { continue; } else { $count++; } } } closedir($handle); } } if ($count > 0) { return false; } else { return true; } }