IImage

interface OCP\IImage
Class for basic image manipulation
Implemented by:OC_Image
Source:lib/public/IImage.php#31

Methods

public OCP\IImage::valid()
Determine whether the object contains an image resource.
Source:lib/public/IImage.php#38
Returns:bool
Since:8.1.0
public OCP\IImage::mimeType()
Returns the MIME type of the image or an empty string if no image is loaded.
Source:lib/public/IImage.php#46
Returns:string
Since:8.1.0
public OCP\IImage::width()
Returns the width of the image or -1 if no image is loaded.
Source:lib/public/IImage.php#54
Returns:int
Since:8.1.0
public OCP\IImage::height()
Returns the height of the image or -1 if no image is loaded.
Source:lib/public/IImage.php#62
Returns:int
Since:8.1.0
public OCP\IImage::widthTopLeft()
Returns the width when the image orientation is top-left.
Source:lib/public/IImage.php#70
Returns:int
Since:8.1.0
public OCP\IImage::heightTopLeft()
Returns the height when the image orientation is top-left.
Source:lib/public/IImage.php#78
Returns:int
Since:8.1.0
public OCP\IImage::show($mimeType=null)
Outputs the image.
Source:

lib/public/IImage.php#87

Parameters:
  • $mimeType (string)
Returns:

bool

Since:

8.1.0

public OCP\IImage::save($filePath=null, $mimeType=null)
Saves the image.
Source:

lib/public/IImage.php#97

Parameters:
  • $filePath (string)
  • $mimeType (string)
Returns:

bool

Since:

8.1.0

public OCP\IImage::resource()
Source:lib/public/IImage.php#103
Returns:resource Returns the image resource in any.
Since:8.1.0
public OCP\IImage::dataMimeType()
Source:lib/public/IImage.php#109
Returns:string Returns the raw data mimetype
Since:13.0.0
public OCP\IImage::data()
Source:lib/public/IImage.php#115
Returns:string Returns the raw image data.
Since:8.1.0
public OCP\IImage::getOrientation()
(I’m open for suggestions on better method name ;)
Get the orientation based on EXIF data.
Source:lib/public/IImage.php#124
Returns:int The orientation or -1 if no EXIF data is available.
Since:8.1.0
public OCP\IImage::fixOrientation()
(I’m open for suggestions on better method name ;)
Fixes orientation based on EXIF data.
Source:lib/public/IImage.php#133
Returns:bool
Since:8.1.0
public OCP\IImage::resize($maxSize)
Resizes the image preserving ratio.
Source:

lib/public/IImage.php#142

Parameters:
  • $maxSize (int) The maximum size of either the width or height.
Returns:

bool

Since:

8.1.0

public OCP\IImage::preciseResize($width, $height)
Source:

lib/public/IImage.php#150

Parameters:
  • $width (int)
  • $height (int)
Returns:

bool

Since:

8.1.0

public OCP\IImage::centerCrop($size=0)
Crops the image to the middle square. If the image is already square it just returns.
Source:

lib/public/IImage.php#159

Parameters:
  • $size (int) maximum size for the result (optional)
Returns:

bool for success or failure

Since:

8.1.0

public OCP\IImage::crop($x, $y, $w, $h)
Crops the image from point $x$y with dimension $wx$h.
Source:

lib/public/IImage.php#171

Parameters:
  • $x (int) Horizontal position
  • $y (int) Vertical position
  • $w (int) Width
  • $h (int) Height
Returns:

bool for success or failure

Since:

8.1.0

public OCP\IImage::fitIn($maxWidth, $maxHeight)
Resizes the image to fit within a boundary while preserving ratio.
Source:

lib/public/IImage.php#181

Parameters:
  • $maxWidth (int)
  • $maxHeight (int)
Returns:

bool

Since:

8.1.0

public OCP\IImage::scaleDownToFit($maxWidth, $maxHeight)
Shrinks the image to fit within a boundary while preserving ratio.
Source:

lib/public/IImage.php#191

Parameters:
  • $maxWidth (int)
  • $maxHeight (int)
Returns:

bool

Since:

8.1.0