Community @ The Turning Gate

Support community for TTG plugins and products.

You are not logged in.

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

Matthew
Administrator
From: Seoul, South Korea
Registered: 2012-09-24
Posts: 5,417
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 /**/

Campagna Pictures, http://campagnapictures.com
The Turning Gate, http://theturninggate.net

Offline

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

kolohe280
Member
Registered: 2017-08-23
Posts: 22

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