DataObjects/Images.php
authoredward <edward@roojs.com>
Wed, 6 Sep 2017 06:29:53 +0000 (14:29 +0800)
committeredward <edward@roojs.com>
Wed, 6 Sep 2017 06:29:53 +0000 (14:29 +0800)
DataObjects/Images.php

index 43a06b8..4ff2642 100644 (file)
@@ -778,11 +778,17 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
             return false;
         }
         
-        $type = pathinfo($file, PATHINFO_EXTENSION);
+        require_once 'File/MimeType.php';
+        
+        $imageInfo = getimagesize($file);
+
+        $y = new File_MimeType();
+
+        $ext = $y->toExt(trim((string) $imageInfo['mime'] ));
         
         $data = file_get_contents($file);
         
-        $base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
+        $base64 = 'data:image/' . $ext . ';base64,' . base64_encode($data);
         
         return $base64;
     }