Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Sure, here you are

    ———–

    @@ -307,6 +307,7 @@
     		$att_title = null;
     		$att_article = null;
     		$att_url = null;
    +		$att_thumbs = null;
     		if (isset($activity->object->attachments)) {
     			foreach ($activity->object->attachments as $attachment) {
     				switch ($attachment->objectType) {
    @@ -332,6 +333,10 @@
     						$att_photo = $attachment->image->url;
     						$att_url = $activity->url;
     						break;
    +					case 'album':
    +						$att_title = $attachment->displayName;
    +						$att_url = $attachment->url;
    +						$att_thumbs = $attachment->thumbnails;
     				}
     			}
     			$post_content .= '<div class="g-crossposting-att">';
    @@ -349,6 +354,18 @@
    
     			if ($att_article) {
     				$post_content .= '<div class="g-crossposting-att-txt"><p>'.$att_article.'</p></div>';
    +				$post_content .= '</div>';
    +			}
    +
    +			if (att_thumbs) {
    +				$post_content .= '<div class="g-crossposting-att-thumbs">';
    +				$first = true;
    +				foreach ($att_thumbs as $thumb) {
    +					$post_content .= "<div class=\"g-crossposting-att-thumbs-thumb\" ".(($first)?'g-crossposting-att-album-cover;" style=\"float:left;"':'')."><a href=\"{$thumb->url}\" target=\"_blank\">";
    +					$post_content .= "<img src=\"{$thumb->image->url}\" />";
    +					$post_content .= '</a></div>';
    +					$first = false;
    +				}
     				$post_content .= '</div>';
     			}
     		}

    Hi,

    I had the same issue like the OP and quickly put an extension for ‘albums’ together.
    Maybe you want to add it sometimes, Sebastian? My code stills needs some streamlining – for example i directly access the JSON structure from Google where you decoded things into your own variables. And the default styling is a bit “hacky”.

    But apart from that it should work, at least as a starter for people who want to adjust it to their needs.

    Here is the diff:

    309a310
    > 		$att_thumbs = null;
    334a336,339
    > 					case 'album':
    > 						$att_title = $attachment->displayName;
    > 						$att_url = $attachment->url;
    > 						$att_thumbs = $attachment->thumbnails;
    351a357,368
    > 				$post_content .= '</div>';
    > 			}
    >
    > 			if (att_thumbs) {
    > 				$post_content .= '<div class="g-crossposting-att-thumbs">';
    > 				$first = true;
    > 				foreach ($att_thumbs as $thumb) {
    > 					$post_content .= "<div class=\"g-crossposting-att-thumbs-thumb\" ".(($first)?'g-crossposting-att-album-cover;" style=\"float:left;"':'')."><a href=\"{$thumb->url}\" target=\"_blank\">";
    > 					$post_content .= "<img src=\"{$thumb->image->url}\" />";
    > 					$post_content .= '</a></div>';
    > 					$first = false;
    > 				}
Viewing 2 replies - 1 through 2 (of 2 total)