* @returns int
*/
public function mimeType() {
- return is_resource($this->resource) ? image_type_to_mime_type($this->imagetype) : '';
+ return $this->valid() ? image_type_to_mime_type($this->imagetype) : '';
}
/**
* @returns int
*/
public function width() {
- return is_resource($this->resource) ? imagesx($this->resource) : -1;
+ return $this->valid() ? imagesx($this->resource) : -1;
}
/**
* @returns int
*/
public function height() {
- return is_resource($this->resource) ? imagesy($this->resource) : -1;
+ return $this->valid() ? imagesy($this->resource) : -1;
}
/**
OC_Log::write('core','OC_Image->fixOrientation() Exif module not enabled.', OC_Log::DEBUG);
return false;
}
- if(!is_resource($this->resource)) {
+ if(!$this->valid()) {
OC_Log::write('core','OC_Image->fixOrientation() No image loaded.', OC_Log::DEBUG);
return false;
}
* @returns bool
*/
public function resize($maxsize) {
- if(!$this->resource) {
+ if(!$this->valid()) {
OC_Log::write('core',__METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
}
* @returns bool for success or failure
*/
public function centerCrop() {
- if(!$this->resource) {
+ if(!$this->valid()) {
OC_Log::write('core','OC_Image->centerCrop, No image loaded', OC_Log::ERROR);
return false;
}
* @returns bool for success or failure
*/
public function crop($x, $y, $w, $h) {
- if(!$this->resource) {
+ if(!$this->valid()) {
OC_Log::write('core',__METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
}