private static function image($path = false, $width = false, $height = false) { if (empty($path)) { return false; } if (empty($width) && empty($height)) { #list($width,$height) = getimagesize($path); list($width, $height) = IMAGES::size($path); } return array('@type' => 'ImageObject', 'url' => $path, 'width' => $width, 'height' => $height); }
function __construct($fileName) { if (!$this->testGDInstalled()) { if ($this->debug) { throw new Exception('The GD Library is not installed.'); } else { throw new Exception(); } } $this->initialise(); // *** Save the image file name. Only store this incase you want to display it $this->fileName = $fileName; $this->fileExtension = fix_strtolower(strrchr($fileName, '.')); // *** Open up the file $this->image = $this->openImage($fileName); // *** Assign here so we don't modify the original $this->imageResized = $this->image; // *** If file is an image if ($this->testIsImage($this->image)) { // *** Get width and height $this->width = imagesx($this->image); $this->widthOriginal = imagesx($this->image); $this->height = imagesy($this->image); $this->heightOriginal = imagesy($this->image); /* Added 15-09-08 * Get the filesize using this build in method. * Stores an array of size * * $this->imageSize[1] = width * $this->imageSize[2] = height * $this->imageSize[3] = width x height * */ if (class_exists('IMAGES')) { $this->imageSize = IMAGES::size($this->fileName); } else { $this->imageSize = getimagesize($this->fileName); } } else { $this->errorArray[] = 'File is not an image'; } }
public static function modify(array $args, $tb_name = false, $related = false) { foreach ($args["id"] as $key => $id) { list($width, $height) = IMAGES::size($args["path"][$key]); $images = array('id' => $id, 'path' => $args["path"][$key], 'alt' => $args["alt"][$key], 'title' => $args["title"][$key], 'width_o' => $width, 'height_o' => $height, 'width' => $args['width'][$key], 'height' => $args['height'][$key], 'width_m' => $args['width_m'][$key], 'height_m' => $args['height_m'][$key], 'info' => $args['info'][$key]); if (empty($id)) { $images = array_merge($images, array('sheet' => $tb_name, 'related' => $related)); CRUD::dataInsert('images', $images); $ID = CRUD::$id; } else { CRUD::dataUpdate('images', $images); $ID = $images['id']; } $rsnum = CRUD::dataFetch('images', array('id' => $id)); if (!empty($rsnum)) { list($imgRow) = CRUD::$data; } self::crop($ID, $images['path'], $images['width'], $images['height'], $images['width_m'], $images['height_m'], $imgRow['crop'], $imgRow['crop_m']); } }