]> git.mxchange.org Git - friendica.git/commitdiff
yet more diaspora images to scale
authorFriendika <info@friendika.com>
Fri, 28 Oct 2011 23:13:54 +0000 (16:13 -0700)
committerFriendika <info@friendika.com>
Fri, 28 Oct 2011 23:13:54 +0000 (16:13 -0700)
boot.php
include/bb2diaspora.php
include/diaspora.php

index 6902023fd2fe55846a566630591a192ab258044d..d2557e11486faeecc97aeabc803f7af0e965ccb8 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -9,7 +9,7 @@ require_once('include/nav.php');
 require_once('include/cache.php');
 
 define ( 'FRIENDIKA_PLATFORM',     'Free Friendika');
-define ( 'FRIENDIKA_VERSION',      '2.3.1147' );
+define ( 'FRIENDIKA_VERSION',      '2.3.1148' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
 define ( 'DB_UPDATE_VERSION',      1099      );
 
index b03ead425adf93848f348095705f064fa257ab16..d5ce6a7d9616ad0e790136d388256d4ee584cbd7 100644 (file)
@@ -38,10 +38,12 @@ function scale_diaspora_images($s,$include_link = true) {
                                                $ph->scaleImage(600);
                                                $new_width = $ph->getWidth();
                                                $new_height = $ph->getHeight();
+                                               logger('scale_diaspora_image: ' . $new_width . 'w ' . $new_height . 'h' . 'match: ' . $mtch[0], LOGGER_DEBUG);
                                                $s = str_replace($mtch[0],'[img=' . $new_width . 'x' . $new_height. ']' . $mtch[1] . '[/img]'
                                                        . "\n" . ((! $include_link) 
                                                                ? '[url=' . $mtch[1] . ']' . t('view full size') . '[/url]' . "\n"
                                                                : ''),$s);
+                                               logger('scale_diaspora_image: new string: ' . $s, LOGGER_DEBUG);
                                        }
                                }
                        }
index 712ddd7b08d3fa86407d42ef1e01228fd9709e2c..ccfa799adc13ecf77d59f841fa55efc4adafc782 100644 (file)
@@ -777,16 +777,19 @@ function diaspora_asphoto($importer,$xml) {
        $created = unxmlify($xml->created_at);
        $private = ((unxmlify($xml->public) == 'false') ? 1 : 0);
 
-       if(strlen($xml->objectId) && ($xml->objectId != 0) && ($xml->image_url))
+       if(strlen($xml->objectId) && ($xml->objectId != 0) && ($xml->image_url)) {
                $body = '[url=' . notags(unxmlify($xml->image_url)) . '][img]' . notags(unxmlify($xml->objectId)) . '[/img][/url]' . "\n";
-       elseif($xml->image_url)
+               $body = scale_diaspora_images($body,false);
+       }
+       elseif($xml->image_url) {
                $body = '[img]' . notags(unxmlify($xml->image_url)) . '[/img]' . "\n";
+               $body = scale_diaspora_images($body);
+       }
        else {
                logger('diaspora_asphoto: no photo url found.');
                return;
        }
 
-
        $datarray = array();
 
        
@@ -1025,6 +1028,8 @@ function diaspora_photo($importer,$xml,$msg) {
 
        $link_text = '[img]' . $remote_photo_path . $remote_photo_name . '[/img]' . "\n";
 
+       $link_text = scale_diaspora_images($link_text);
+
        if(strpos($parent_item['body'],$link_text) === false) {
                $r = q("update item set `body` = '%s', `visible` = 1 where `id` = %d and `uid` = %d limit 1",
                        dbesc($link_text . $parent_item['body']),