<?php $data = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABl' . 'BMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDr' . 'EX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r' . '8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg=='; $data = base64_decode($data); require_once '../Image.php'; use Gregwar\Image\Image; $gd = imagecreatefromstring($data); Image::fromResource($gd)->save('out.jpg');
/** * Upsert an image resource with a given storage key * * @param string $targetName storage key * @param resource $imgRsrc image resource */ public function upsertResource($targetName, $imgRsrc) { $path = $this->getStoragePath($targetName); Image::fromResource($imgRsrc)->setCacheDir($this->cacheDir)->cropResize($this->sizeConfig[self::MAX_RES], $this->sizeConfig[self::MAX_RES])->save($path); }