/** * @param Service $thumbator * @param string $original * @param string $filename * @param int $width * @param int $height * @param int $method * @return string */ public function placehold($thumbator, $original, $filename, $width, $height, $method) { try { $data = @file_get_contents(sprintf($this->placeholder, $width, $height)); if ($data) { $image = Image::fromString($data); Helpers::mkdir(dirname($thumbator->config->getStorageDir() . DIRECTORY_SEPARATOR . $original)); $image->save($thumbator->config->getStorageDir() . DIRECTORY_SEPARATOR . $original); return $thumbator->create($original, $width, $height, $method); } } catch (\Exception $e) { // Silent.. } return sprintf($this->placeholder, $width, $height); }
/** * @param string $src Image path * @param int $width Image width * @param int $height Image height * @param int $mode Image resize mod */ public function image($src, $width = NULL, $height = NULL, $mode = Image::SHRINK_ONLY) { return $this->service->create(trim($src), $width, $height, $mode); }