Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2018-10-11 11:02:45

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Create a custom image loop w/ PHPlugins

I cannot find the thread in which this was originally asked about, but here's some stuff you can do in Backlight 2, using the new PHPlugins functionality, to create a custom image loop.

/* DELETE THIS LINE
// Create a custom image loop for albums
function album_top()
{
	if ($this->hasAlbum()) {
		$photos = $this->album->getPhotosForPage();
		foreach ( $photos as $photo ) {

			$th_path = $photo->getURL('thumbnails'); // thumbnail src
			$th_h    = $photo->getThumbnailHeight(); // thumbnail height
			$th_w    = $photo->getThumbnailWidth();  // thumbnail width

			$ph_path = $photo->getUrl('photos'); // photo src
			$ph_h    = $photo->getPhotoHeight(); // photo height
			$ph_w    = $photo->getPhotoWidth();  // photo width
			$ph_id   = $photo->getItemNumber();  // photo number
			$ph_page = $photo->getSingleURL();   // link to photo page

			$orientation = $th_w === $th_h ? 'square' : ( $th_w > $th_h ? 'landscape' : 'portrait' );

			$img_alt     = $photo->getFilename();
			$img_caption = $photo->hasMetadata(Photo::$PHOTO_CAPTION) ? $photo->getMetadata(Photo::$PHOTO_CAPTION) : '';
			$img_title   = $photo->hasMetadata(Photo::$PHOTO_TITLE) ? $photo->getMetadata(Photo::$PHOTO_TITLE) : $photo->getFilename();

			echo '<p style="margin-bottom: 1.5rem">';
			echo '<img src="'. $th_path .'" alt="'. $img_caption .'" /><br />';
			echo $photo->getFilename();
			echo '</p>';

		}
	}
	return false;
} // END /**/

Matt

The Turning Gate, http://theturninggate.net

Offline

#2 2018-10-11 11:19:59

kolohe280
Member
From: Talent, Oregon
Registered: 2017-08-23
Posts: 53

Re: Create a custom image loop w/ PHPlugins

That question was probably from me, and was something I added on to a somewhat unrelated topic (bad me).

Is there some code I can look at lists all the data/function calls that are accessible?  Examples are great, but I'm an old mainframe guy who was accustomed to volumes and volumes of documentation that listed everything.  I don't mind hunting through the code to figure it out, but I have no idea where to start looking.

Thanks!

Offline

Board footer

Powered by FluxBB