/var/www/vhosts/ihelp.ro/httpdocs/vendor/intervention/image/src/Intervention/Image
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/intervention/image/src/Intervention/Image/Image.php (20349B)
driver = $driver;
$this->core = $core;
}
/**
* Magic method to catch all image calls
* usually any AbstractCommand
*
* @param string $name
* @param Array $arguments
* @return mixed
*/
public function __call($name, $arguments)
{
$command = $this->driver->executeCommand($this, $name, $arguments);
return $command->hasOutput() ? $command->getOutput() : $this;
}
/**
* Starts encoding of current image
*
* @param string $format
* @param int $quality
* @return \Intervention\Image\Image
*/
public function encode($format = null, $quality = 90)
{
return $this->driver->encode($this, $format, $quality);
}
/**
* Saves encoded image in filesystem
*
* @param string $path
* @param int $quality
* @param string $format
* @return \Intervention\Image\Image
*/
public function save($path = null, $quality = null, $format = null)
{
$path = is_null($path) ? $this->basePath() : $path;
if (is_null($path)) {
throw new NotWritableException(
"Can't write to undefined path."
);
}
if ($format === null) {
$format = pathinfo($path, PATHINFO_EXTENSION);
}
$data = $this->encode($format, $quality);
$saved = @file_put_contents($path, $data);
if ($saved === false) {
throw new NotWritableException(
"Can't write image data to path ({$path})"
);
}
// set new file info
$this->setFileInfoFromPath($path);
return $this;
}
/**
* Runs a given filter on current image
*
* @param FiltersFilterInterface $filter
* @return \Intervention\Image\Image
*/
public function filter(Filters\FilterInterface $filter)
{
return $filter->applyFilter($this);
}
/**
* Returns current image driver
*
* @return \Intervention\Image\AbstractDriver
*/
public function getDriver()
{
return $this->driver;
}
/**
* Sets current image driver
* @param AbstractDriver $driver
*/
public function setDriver(AbstractDriver $driver)
{
$this->driver = $driver;
return $this;
}
/**
* Returns current image resource/obj
*
* @return mixed
*/
public function getCore()
{
return $this->core;
}
/**
* Sets current image resource
*
* @param mixed $core
*/
public function setCore($core)
{
$this->core = $core;
return $this;
}
/**
* Returns current image backup
*
* @param string $name
* @return mixed
*/
public function getBackup($name = null)
{
$name = is_null($name) ? 'default' : $name;
if ( ! $this->backupExists($name)) {
throw new RuntimeException(
"Backup with name ({$name}) not available. Call backup() before reset()."
);
}
return $this->backups[$name];
}
/**
* Returns all backups attached to image
*
* @return array
*/
public function getBackups()
{
return $this->backups;
}
/**
* Sets current image backup
*
* @param mixed $resource
* @param string $name
* @return self
*/
public function setBackup($resource, $name = null)
{
$name = is_null($name) ? 'default' : $name;
$this->backups[$name] = $resource;
return $this;
}
/**
* Checks if named backup exists
*
* @param string $name
* @return bool
*/
private function backupExists($name)
{
return array_key_exists($name, $this->backups);
}
/**
* Checks if current image is already encoded
*
* @return boolean
*/
public function isEncoded()
{
return ! empty($this->encoded);
}
/**
* Returns encoded image data of current image
*
* @return string
*/
public function getEncoded()
{
return $this->encoded;
}
/**
* Sets encoded image buffer
*
* @param string $value
*/
public function setEncoded($value)
{
$this->encoded = $value;
return $this;
}
/**
* Calculates current image width
*
* @return int
*/
public function getWidth()
{
return $this->getSize()->width;
}
/**
* Alias of getWidth()
*
* @return int
*/
public function width()
{
return $this->getWidth();
}
/**
* Calculates current image height
*
* @return int
*/
public function getHeight()
{
return $this->getSize()->height;
}
/**
* Alias of getHeight
*
* @return int
*/
public function height()
{
return $this->getHeight();
}
/**
* Reads mime type
*
* @return string
*/
public function mime()
{
return $this->mime;
}
/**
* Returns encoded image data in string conversion
*
* @return string
*/
public function __toString()
{
return $this->encoded;
}
/**
* Cloning an image
*/
public function __clone()
{
$this->core = $this->driver->cloneCore($this->core);
}
}