]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/oembed.php
Mark OembedAction, XrdAction, and (plugin) AutocompleteAction as read-only. Tweaked...
[quix0rs-gnu-social.git] / actions / oembed.php
index 11d814583701a78a23392042b8dd861618e8f532..bef707f92adeb8c1cec8e8cbd81fd536ee8ddc4b 100644 (file)
@@ -108,9 +108,16 @@ class OembedAction extends Action
                         $oembed['url']=$file_oembed->url;
                     }else if(substr($attachment->mimetype,0,strlen('image/'))=='image/'){
                         $oembed['type']='photo';
-                        //TODO set width and height
-                        //$oembed['width']=
-                        //$oembed['height']=
+                        if ($attachment->filename) {
+                            $filepath = File::path($attachment->filename);
+                            $gis = @getimagesize($filepath);
+                            if ($gis) {
+                                $oembed['width'] = $gis[0];
+                                $oembed['height'] = $gis[1];
+                            } else {
+                                // TODO Either throw an error or find a fallback?
+                            }
+                        }
                         $oembed['url']=$attachment->url;
                         $thumb = $attachment->getThumbnail();
                         if ($thumb) {
@@ -208,4 +215,15 @@ class OembedAction extends Action
         return;
     }
 
+    /**
+     * Is this action read-only?
+     *
+     * @param array $args other arguments
+     *
+     * @return boolean is read only action?
+     */
+    function isReadOnly($args)
+    {
+        return true;
+    }
 }