aboutsummaryrefslogtreecommitdiffstats
path: root/include/bb2diaspora.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-10-27 19:12:30 -0700
committerFriendika <info@friendika.com>2011-10-27 19:12:30 -0700
commite5a7b3e24b5eccf31be7ef5b78580b599a94952f (patch)
tree190e705b539c698fdcb5a198c48e0cc6172b16d7 /include/bb2diaspora.php
parent056fe0a3aabecdc3a236ce9350e4e6f54ef52758 (diff)
downloadvolse-hubzilla-e5a7b3e24b5eccf31be7ef5b78580b599a94952f.tar.gz
volse-hubzilla-e5a7b3e24b5eccf31be7ef5b78580b599a94952f.tar.bz2
volse-hubzilla-e5a7b3e24b5eccf31be7ef5b78580b599a94952f.zip
add contact-id to auto-complete response to resolve duplicates
Diffstat (limited to 'include/bb2diaspora.php')
-rw-r--r--include/bb2diaspora.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index f7398067b..efbf34758 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -17,11 +17,36 @@ function diaspora2bb($s) {
$s = preg_replace("/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[vimeo]$2[/vimeo]',$s);
$s = preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[vimeo]$1[/vimeo]',$s);
$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url]$2$3$4[/url]',$s);
-
+ $s = scale_diaspora_images($s);
return $s;
}
+function scale_diaspora_images($s) {
+
+ $matches = null;
+ $c = preg_match_all('/\[img\](.*?)\[\/img\]/ism',$s,$matches,PREG_SET_ORDER);
+ if($c) {
+ require_once('include/Photo.php');
+ foreach($matches as $mtch) {
+ $i = fetch_url($mtch[1]);
+ if($i) {
+ $ph = new Photo($i);
+ if($ph->is_valid()) {
+ if($ph->getWidth() > 600 || $ph->getHeight() > 600) {
+ $ph->scaleImage(600);
+ $new_width = $ph->getWidth();
+ $new_height = $ph->getHeight();
+ $s = str_replace($mtch[0],'[img=' . $new_width . 'x' . $new_height. ']' . $mtch[1] . '[/img]'
+ . "\n" . '[url=' . $mtch[1] . ']' . t('view full size') . '[/url]' . "\n",$s);
+ }
+ }
+ }
+ }
+ }
+ return $s;
+}
+
function stripdcode_br_cb($s) {
return '[code]' . str_replace('<br />', "\n\t", $s[1]) . '[/code]';
}