Horde_Image_Base::toFile PHP Method

toFile() public method

If $data is false, saves current image data after performing any pending operations on the data. If $data contains raw image data, saves that data to file without regard for the current image data.
public toFile ( $data = null ) : string
return string Path to temporary file.
    public function toFile($data = null)
    {
        $tmp = Horde_Util::getTempFile('img', false, $this->_tmpdir);
        $fp = fopen($tmp, 'wb');
        fwrite($fp, $data ?: $this->raw());
        fclose($fp);
        return $tmp;
    }

Usage Example

Example #1
0
 /**
  * Wraps the given view into a file.
  *
  * @param string $view  Which view to wrap up.
  *
  * @return string  Path to temporary file.
  * @deprecated Not used anywhere, remove in A4.
  */
 public function toFile($view = 'full')
 {
     $this->load($view);
     return $this->_image->toFile($this->_dirty ? false : $this->_data[$view]);
 }