function makethumbnail($src_file, $newSize, $method) { global $CONFIG; $content_type = array(IMAGETYPE_GIF => 'gif', IMAGETYPE_JPEG => 'jpeg', IMAGETYPE_PNG => 'png'); // Checks that file exists and is readable if (!filesize($src_file) || !is_readable($src_file)) { header("Content-type: image/gif"); fpassthru(fopen(READ_ERROR_ICON, 'rb')); exit; } // find the image size, no size => unknow type $imginfo = getimagesize($src_file); if ($imginfo == null) { header("Content-type: image/gif"); fpassthru(fopen(UNKNOW_ICON, 'rb')); exit; } // GD can't handle gif images if ($imginfo[2] == IMAGETYPE_GIF && ($method == 'gd1' || $method == 'gd2') && !function_exists('imagecreatefromgif')) { header("Content-type: image/gif"); fpassthru(fopen(GIF_ICON, 'rb')); exit; } // height/width $ratio = max(max($imginfo[0], $imginfo[1]) / $newSize, 1.0); $dest_info[0] = intval($imginfo[0] / $ratio); $dest_info[1] = intval($imginfo[1] / $ratio); $dest_info['quality'] = intval($CONFIG['jpeg_qual']); require_once 'includes/imaging/imaging.inc'; if (!Graphic::show($src_file, $dest_info)) { return false; } }
/** * Constructor * @param Node $parent */ public function __construct($position = false, $text = false) { parent::__construct(); if (!$position) { $position = new Point(0, 0); } $this->position = $position; if (!$text) { $text = "Some text here"; } $this->text = $text; }
/** * Constructor * @param Node $parent */ public function __construct($start = null, $end = null) { parent::__construct(); if (!$start) { $start = new Point(0, 0); } $this->start = $start; if (!$end) { $end = new Point(100, 100); } $this->end = $end; }
/** * Main constructor */ function __construct() { parent::__construct(); // Default initialisation $this->elements = array(); $this->isLayoutVertical = false; $this->isLayoutHorizontal = false; $this->isLayoutWrapping = false; $this->hasPath = false; $this->hasLoop = false; $this->hasLoopLabel = false; $this->loopLabel = ''; $this->hasComment = false; $this->comment = ''; $this->hasCondition = false; $this->hasDots = false; $this->margin = 0; }
function _default() { return array_merge(parent::_default(), array('grid-independant-location' => 'horizontal', 'grid-reverse' => false, 'grid-background' => 'FillStroke-Gray', 'grid-horizontal-position' => 'bottom', 'grid-vertical-position' => 'left', 'grid-independant-scale' => 'linear', 'grid-independant-linear-count' => 10, 'grid-independant-zero-style' => 'Bold-LineStroke-Black', 'grid-independant-minor-style' => 'Thin-LineStroke-Black', 'grid-independant-minor-size' => 0.01, 'grid-independant-minor-font' => false, 'grid-independant-minor-guide' => false, 'grid-independant-major-style' => 'LineStroke-Black', 'grid-independant-major-size' => 0.02, 'grid-independant-major-font' => 'Large-Text', 'grid-independant-major-guide' => false, 'grid-dependant-scale' => 'linear', 'grid-dependant-linear-count' => 10, 'grid-dependant-zero-style' => 'Bold-LineStroke-Black', 'grid-dependant-minor-style' => 'Thin-LineStroke-Black', 'grid-dependant-minor-size' => 0.01, 'grid-dependant-minor-font' => false, 'grid-dependant-minor-guide' => false, 'grid-dependant-major-style' => 'LineStroke-Black', 'grid-dependant-major-size' => 0.02, 'grid-dependant-major-font' => 'Large-Text', 'grid-dependant-major-guide' => 'Thin-LineStroke-Black')); }
function _default() { return array_merge(parent::_default(), array('pie-center-x' => 0.5, 'pie-center-y' => 0.5, 'pie-radius' => 0.4)); }
public function LatestGraphics() { $graphics = Graphic::get()->sort(array('SortOrder' => 'ASC', 'Created' => 'ASC'))->innerJoin('GraphicFile', 'GraphicFile.GraphicID = Graphic.ID'); return $graphics; }
/** * Constructor * @param Node $parent */ public function __construct($x = 0, $y = 0) { parent::__construct(); $this->x = $x; $this->y = $y; }
function create_thumbnail($source, $new_file) { global $attach_config; $source = amod_realpath($source); $min_filesize = intval($attach_config['img_min_thumb_filesize']); $img_filesize = file_exists(amod_realpath($source)) ? filesize($source) : false; if (!$img_filesize || $img_filesize <= $min_filesize) { return FALSE; } $size = image_getdimension($source); if ($size[0] <= 0 && $size[1] <= 0) { return FALSE; } $new_size = get_img_size_format($size[0], $size[1]); $tmp_path = ''; $old_file = ''; if (intval($attach_config['allow_ftp_upload'])) { $old_file = $new_file; $tmp_path = explode('/', $source); $tmp_path[count($tmp_path) - 1] = ''; $tmp_path = implode('/', $tmp_path); if ($tmp_path == '') { $tmp_path = '/tmp'; } $value = trim($tmp_path); if ($value[strlen($value) - 1] == '/') { $value[strlen($value) - 1] = ' '; } $new_file = trim($value) . '/t00000'; } global $MAIN_CFG; if (!isset($MAIN_CFG['imaging']['type'])) { //$attach_config['use_gd2'] $MAIN_CFG['imaging']['type'] = empty($attach_config['img_imagick']) ? 'gd2' : 'im'; $MAIN_CFG['imaging']['impath'] = $attach_config['img_imagick']; $MAIN_CFG['imaging']['pbmpath'] = $attach_config['img_imagick']; } require_once 'includes/imaging/imaging.inc'; Graphic::resize($source, $new_size, $new_file, $size); if (!file_exists(amod_realpath($new_file))) { return FALSE; } if (intval($attach_config['allow_ftp_upload'])) { $result = ftp_file($new_file, $old_file, $this->type, TRUE); // True for disable error-mode if (!$result) { return FALSE; } } else { chmod($new_file, PHP_AS_NOBODY ? 0666 : 0644); } return TRUE; }