DataObjects/Images.php
authorEdward <edward@roojs.com>
Tue, 21 Aug 2018 13:42:14 +0000 (21:42 +0800)
committerEdward <edward@roojs.com>
Tue, 21 Aug 2018 13:42:14 +0000 (21:42 +0800)
DataObjects/Images.php

index c778b52..d90463d 100644 (file)
@@ -816,7 +816,7 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
         
     }
     
-    function toBase64()
+    function toBase64($rotate = false)
     {
         if(!preg_match('/^image\//', $this->mimetype)){
             return false;
@@ -830,6 +830,10 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
         
         $data = file_get_contents($file);
         
+        if($rotate){
+            $data = $this->rotate();
+        }
+        
         $base64 = 'data:' . $this->mimetype . ';base64,' . base64_encode($data);
         
         return $base64;