}
- function toBase64()
+ function toBase64($rotate = false)
{
if(!preg_match('/^image\//', $this->mimetype)){
return false;
$data = file_get_contents($file);
+ if($rotate){
+ $data = $this->rotate();
+ }
+
$base64 = 'data:' . $this->mimetype . ';base64,' . base64_encode($data);
return $base64;
return $page;
}
- function rotate($blob = false)
+ function rotate()
{
- if(empty($this->id) && !$blob){
- return false;
- }
-
- $imagick = new Imagick();
-
- if(!empty($this->id)){
- $imagick->readimage($this->getStoreName());
- } else {
- $imagick->readImageBlob($blob);
- }
+ $imagick = new Imagick($this->getStoreName());
$orientation = $imagick->getImageOrientation();