Merge pull request #14857 from owncloud/preview-provider-registration-in-manager
Preview provider registration in managerremotes/origin/etag-endpoint
commit
afa8872955
@ -0,0 +1,146 @@ |
||||
<?php |
||||
/** |
||||
* ownCloud |
||||
* |
||||
* @author Joas Schilling |
||||
* @copyright 2015 Joas Schilling nickvergessen@owncloud.com |
||||
* |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
namespace OCP; |
||||
|
||||
/** |
||||
* Class for basic image manipulation |
||||
*/ |
||||
interface IImage { |
||||
/** |
||||
* Determine whether the object contains an image resource. |
||||
* |
||||
* @return bool |
||||
*/ |
||||
public function valid(); |
||||
|
||||
/** |
||||
* Returns the MIME type of the image or an empty string if no image is loaded. |
||||
* |
||||
* @return string |
||||
*/ |
||||
public function mimeType(); |
||||
|
||||
/** |
||||
* Returns the width of the image or -1 if no image is loaded. |
||||
* |
||||
* @return int |
||||
*/ |
||||
public function width(); |
||||
|
||||
/** |
||||
* Returns the height of the image or -1 if no image is loaded. |
||||
* |
||||
* @return int |
||||
*/ |
||||
public function height(); |
||||
|
||||
/** |
||||
* Returns the width when the image orientation is top-left. |
||||
* |
||||
* @return int |
||||
*/ |
||||
public function widthTopLeft(); |
||||
|
||||
/** |
||||
* Returns the height when the image orientation is top-left. |
||||
* |
||||
* @return int |
||||
*/ |
||||
public function heightTopLeft(); |
||||
|
||||
/** |
||||
* Outputs the image. |
||||
* |
||||
* @param string $mimeType |
||||
* @return bool |
||||
*/ |
||||
public function show($mimeType = null); |
||||
|
||||
/** |
||||
* Saves the image. |
||||
* |
||||
* @param string $filePath |
||||
* @param string $mimeType |
||||
* @return bool |
||||
*/ |
||||
public function save($filePath = null, $mimeType = null); |
||||
|
||||
/** |
||||
* @return resource Returns the image resource in any. |
||||
*/ |
||||
public function resource(); |
||||
|
||||
/** |
||||
* @return string Returns the raw image data. |
||||
*/ |
||||
public function data(); |
||||
|
||||
/** |
||||
* (I'm open for suggestions on better method name ;) |
||||
* Get the orientation based on EXIF data. |
||||
* |
||||
* @return int The orientation or -1 if no EXIF data is available. |
||||
*/ |
||||
public function getOrientation(); |
||||
|
||||
/** |
||||
* (I'm open for suggestions on better method name ;) |
||||
* Fixes orientation based on EXIF data. |
||||
* |
||||
* @return bool. |
||||
*/ |
||||
public function fixOrientation(); |
||||
|
||||
/** |
||||
* Resizes the image preserving ratio. |
||||
* |
||||
* @param integer $maxSize The maximum size of either the width or height. |
||||
* @return bool |
||||
*/ |
||||
public function resize($maxSize); |
||||
|
||||
/** |
||||
* @param int $width |
||||
* @param int $height |
||||
* @return bool |
||||
*/ |
||||
public function preciseResize($width, $height); |
||||
|
||||
/** |
||||
* Crops the image to the middle square. If the image is already square it just returns. |
||||
* |
||||
* @param int $size maximum size for the result (optional) |
||||
* @return bool for success or failure |
||||
*/ |
||||
public function centerCrop($size = 0); |
||||
|
||||
/** |
||||
* Crops the image from point $x$y with dimension $wx$h. |
||||
* |
||||
* @param int $x Horizontal position |
||||
* @param int $y Vertical position |
||||
* @param int $w Width |
||||
* @param int $h Height |
||||
* @return bool for success or failure |
||||
*/ |
||||
public function crop($x, $y, $w, $h); |
||||
|
||||
/** |
||||
* Resizes the image to fit within a boundary while preserving ratio. |
||||
* |
||||
* @param integer $maxWidth |
||||
* @param integer $maxHeight |
||||
* @return bool |
||||
*/ |
||||
public function fitIn($maxWidth, $maxHeight); |
||||
} |
@ -0,0 +1,39 @@ |
||||
<?php |
||||
/** |
||||
* ownCloud |
||||
* |
||||
* @author Joas Schilling |
||||
* @copyright 2015 Joas Schilling nickvergessen@owncloud.com |
||||
* |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
namespace OCP\Preview; |
||||
|
||||
interface IProvider { |
||||
/** |
||||
* @return string Regex with the mimetypes that are supported by this provider |
||||
*/ |
||||
public function getMimeType(); |
||||
|
||||
/** |
||||
* Check if a preview can be generated for $path |
||||
* |
||||
* @param \OCP\Files\FileInfo $file |
||||
* @return bool |
||||
*/ |
||||
public function isAvailable(\OCP\Files\FileInfo $file); |
||||
|
||||
/** |
||||
* get thumbnail for file at path $path |
||||
* |
||||
* @param string $path Path of file |
||||
* @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image |
||||
* @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image |
||||
* @param bool $scalingup Disable/Enable upscaling of previews |
||||
* @param \OC\Files\View $fileview fileview object of user folder |
||||
* @return bool|\OCP\IImage false if no preview was generated |
||||
*/ |
||||
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview); |
||||
} |
Loading…
Reference in new issue