diff options
author | redmatrix <git@macgirvin.com> | 2016-02-02 17:14:07 -0800 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-02-02 17:14:07 -0800 |
commit | 06dcaaa821d6229568709e53d104233081c4d3e9 (patch) | |
tree | 8388044eade0679a617a57ea990c8903edad2d3f /include | |
parent | 88669fa033d5b43d4cdad7b95c9af05bf9467d3b (diff) | |
download | volse-hubzilla-06dcaaa821d6229568709e53d104233081c4d3e9.tar.gz volse-hubzilla-06dcaaa821d6229568709e53d104233081c4d3e9.tar.bz2 volse-hubzilla-06dcaaa821d6229568709e53d104233081c4d3e9.zip |
some zcard cleanup - still eneds a lot more work
Diffstat (limited to 'include')
-rw-r--r-- | include/identity.php | 47 | ||||
-rwxr-xr-x | include/oembed.php | 12 |
2 files changed, 42 insertions, 17 deletions
diff --git a/include/identity.php b/include/identity.php index 037cf5061..76ada577e 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1786,11 +1786,42 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { logger('get_zcard'); + $maxwidth = (($args['width']) ? intval($args['width']) : 0); + $maxheight = (($args['height']) ? intval($args['height']) : 0); + + + if(($maxwidth > 1200) || ($maxwidth < 1)) + $maxwidth = 1200; + + if($maxwidth <= 425) { + $width = 425; + $size = 'hz_small'; + $cover_size = PHOTO_RES_COVER_425; + $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 80 , 'height' => 80, 'href' => $channel['xchan_photo_m']); + } + elseif($maxwidth <= 850) { + $width = 850; + $size = 'hz_medium'; + $cover_size = PHOTO_RES_COVER_850; + $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 160 , 'height' => 160, 'href' => $channel['xchan_photo_l']); + } + elseif($maxwidth <= 1200) { + $width = 1200; + $size = 'hz_large'; + $cover_size = PHOTO_RES_COVER_1200; + $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']); + } + +// $scale = (float) $maxwidth / $width; +// $translate = intval(($scale / 1.0) * 100); + + $channel['channel_addr'] = $channel['channel_address'] . '@' . get_app()->get_hostname(); + $zcard = array('chan' => $channel); $r = q("select height, width, resource_id, scale, type from photo where uid = %d and scale = %d and photo_usage = %d", intval($channel['channel_id']), - intval(PHOTO_RES_COVER_1200), + intval($cover_size), intval(PHOTO_COVER) ); @@ -1799,22 +1830,10 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['scale']; } - $pphoto = array('type' => $channel['xchan_photo_mimetype'], - 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']); - - $maxwidth = (($args['width']) ? intval($args['width']) : 0); - $maxheight = (($args['height']) ? intval($args['height']) : 0); - - $zcard = array('chan' => $channel); - if(($maxwidth > 1200) || ($maxwidth < 1)) - $maxwidth = 1200; - $scale = (float) $maxwidth / 1200; - - $translate = intval(($scale / 1.0) * 100); - $o .= replace_macros(get_markup_template('zcard.tpl'),array( '$scale' => $scale, '$translate' => $translate, + '$size' => $size, '$cover' => $cover, '$pphoto' => $pphoto, '$zcard' => $zcard diff --git a/include/oembed.php b/include/oembed.php index ff52545ee..7c577b6c2 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -217,10 +217,16 @@ function oembed_format_object($j){ } function oembed_iframe($src,$width,$height) { - if(! $width || strstr($width,'%')) + $scroll = ' scrolling="no" '; + if(! $width || strstr($width,'%')) { $width = '640'; - if(! $height || strstr($height,'%')) + $scroll = ' scrolling="auto" '; + } + if(! $height || strstr($height,'%')) { $height = '300'; + $scroll = ' scrolling="auto" '; + } + // try and leave some room for the description line. $height = intval($height) + 80; $width = intval($width) + 40; @@ -229,7 +235,7 @@ function oembed_iframe($src,$width,$height) { // Make sure any children are sandboxed within their own iframe. - return '<iframe height="' . $height . '" width="' . $width . '" src="' . $s . '" frameborder="no" >' + return '<iframe ' . $scroll . 'height="' . $height . '" width="' . $width . '" src="' . $s . '" frameborder="no" >' . t('Embedded content') . '</iframe>'; } |