/** * Set up file object * * @param string|array $allowed_hosts * @return \Fuzz\ImageResizer\File */ public function setupFile($allowed_hosts) { if (is_string($allowed_hosts)) { $this->checkDomain(explode(',', $allowed_hosts)); } else { $this->checkDomain($allowed_hosts); } // Setup file return $this->file = File::createFromBlob(file_get_contents($this->source)); }
public function testItCanReturnRawImageData() { $blob = file_get_contents($this->getPlaceholditImage(300, 300)); $file = File::createFromBlob($blob); $this->assertTrue(is_string($file->getRaw())); }
public function testItSetsCompressionQuality() { $file = File::createFromBlob(file_get_contents(__DIR__ . '/images/stock-photo.jpg')); // ~814kb $image = new Image($file, false); $options = ['height' => '200', 'width' => '400', 'min_quality' => 2, 'max_quality' => 100, 'max_file_size_bytes' => 800000]; $image->alterImage($options); $this->assertEquals(96, $image->getImageHandler()->getImageCompressionQuality()); }
public function getImageFile($height, $width) { return File::createFromBlob(file_get_contents($this->getPlaceholditImage($height, $width))); }