projects
/
Pman.Core
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
DataObjects/Images.php
[Pman.Core]
/
DataObjects
/
Images.php
diff --git
a/DataObjects/Images.php
b/DataObjects/Images.php
index
f550e0e
..
1af610b
100644
(file)
--- a/
DataObjects/Images.php
+++ b/
DataObjects/Images.php
@@
-830,15
+830,11
@@
class Pman_Core_DataObjects_Images extends DB_DataObject
$data = file_get_contents($file);
$data = file_get_contents($file);
- if($rotate){
- $data = $this->rotate();
- }
-
if(!empty($scaleWidth) || !empty($scaleHeight)){
$width = $this->width;
$height = $this->height;
if(!empty($scaleWidth) || !empty($scaleHeight)){
$width = $this->width;
$height = $this->height;
-
+
if(!empty($scaleWidth)){
$width = $scaleWidth;
if(!empty($scaleWidth)){
$width = $scaleWidth;
@@
-846,6
+842,8
@@
class Pman_Core_DataObjects_Images extends DB_DataObject
$height = $this->height * $scaleWidth / $this->width;
}
}
$height = $this->height * $scaleWidth / $this->width;
}
}
+
+
if(!empty($scaleHeight)){
$height = $scaleHeight;
if(!empty($scaleHeight)){
$height = $scaleHeight;
@@
-855,9
+853,9
@@
class Pman_Core_DataObjects_Images extends DB_DataObject
}
}
}
}
- $im = imagecreatefromstring($data
, IMG_NEAREST_NEIGHBOUR
);
+ $im = imagecreatefromstring($data);
- if (($scaled = imagescale($im, $width, $
width
)) != false) {
+ if (($scaled = imagescale($im, $width, $
height
)) != false) {
ob_start();
imagejpeg($scaled);
$data = ob_get_contents();
ob_start();
imagejpeg($scaled);
$data = ob_get_contents();
@@
-868,6
+866,10
@@
class Pman_Core_DataObjects_Images extends DB_DataObject
}
}
+ if($rotate){
+ $data = $this->rotate();
+ }
+
$base64 = 'data:' . $this->mimetype . ';base64,' . base64_encode($data);
return $base64;
$base64 = 'data:' . $this->mimetype . ';base64,' . base64_encode($data);
return $base64;
@@
-903,9
+905,14
@@
class Pman_Core_DataObjects_Images extends DB_DataObject
return $page;
}
return $page;
}
- function rotate()
+ function rotate(
$imageBlob = false
)
{
{
- $imagick = new Imagick($this->getStoreName());
+ if(empty($imageBlob)){
+ $imagick = new Imagick($this->getStoreName());
+ } else {
+ $imagick = new Imagick();
+ $imagick->readImageBlob($imageBlob);
+ }
$orientation = $imagick->getImageOrientation();
$orientation = $imagick->getImageOrientation();