Minor - format code, fix php warning

pull/2458/head
jmontoyaa 8 years ago
parent bd12778eda
commit 911b715325
  1. 4
      main/inc/lib/extra_field_value.lib.php
  2. 41
      main/inc/lib/image.lib.php

@ -124,10 +124,9 @@ class ExtraFieldValue extends Model
continue;
}
$value = '';
if (isset($params['extra_'.$field_variable])) {
$value = $params['extra_'.$field_variable];
} else {
$value = '';
}
$extraFieldInfo = $this->getExtraField()->get_handler_field_info_by_field_variable($field_variable);
@ -213,7 +212,6 @@ class ExtraFieldValue extends Model
$fieldRelTag->setFieldId($extraFieldInfo['id']);
$fieldRelTag->setItemId($params['item_id']);
$fieldRelTag->setTagId($tag->getId());
$em->persist($fieldRelTag);
}

@ -61,26 +61,35 @@ class Image
}
}
/**
* @param $cropParameters
* @return bool
*/
public function crop($cropParameters)
{
$image_size = $this->get_image_size($this->image_wrapper->path);
$src_width = $image_size['width'];
$src_height = $image_size['height'];
$cropParameters = explode(",", $cropParameters);
$x = intval($cropParameters[0]);
$y = intval($cropParameters[1]);
$width = intval($cropParameters[2]);
$height = intval($cropParameters[3]);
$image = $this->image_wrapper->crop(
$x,
$y,
$width,
$height,
$src_width,
$src_height
);
return $image;
$cropParameters = explode(',', $cropParameters);
if (isset($cropParameters[0]) && isset($cropParameters[1])) {
$x = intval($cropParameters[0]);
$y = intval($cropParameters[1]);
$width = intval($cropParameters[2]);
$height = intval($cropParameters[3]);
$image = $this->image_wrapper->crop(
$x,
$y,
$width,
$height,
$src_width,
$src_height
);
return $image;
}
return false;
}
/**
@ -267,6 +276,7 @@ class ImagickWrapper extends ImageWrapper
* @param int $height the height of the crop
* @param int $src_width the source width of the original image
* @param int $src_height the source height of the original image
* @return bool
*/
public function crop($x, $y, $width, $height, $src_width, $src_height)
{
@ -276,6 +286,7 @@ class ImagickWrapper extends ImageWrapper
$this->image->cropimage($width, $height, $x, $y);
$this->width = $width;
$this->height = $height;
return true;
}
public function send_image(

Loading…
Cancel
Save