Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
mck_picasa
mck_picasa
Download plugin at www.kreatore.it/txp/mck_picasa
Table of contents
- Intro and Description
- Requirements
- Installation and usage
- Tags and Attributes
- Examples
- Changelog
- TODO
- Thanks to
Intro and Description
There is different method to show Google Picasa Web Album on own website, but if I don’t mistake, this is the first plugin that integrate Picasa Web into Textpattern.
The main idea [of mine] was to semplify adding a single album of PWA at an TXP article. Directly I have search a script for read a feed of PWA and show all albums or photos into a single article or a complete gallery
The first release was very simple, with no personalization of HTML output. After have read and write mck_login I understand that to may hack the last release and made it better. This is the result!
Requirements
Recommended:
- PHP 5.1.2+
- Textpattern 4.4.1+
- Curl enabled
Installation and usage
The general behavior stands: paste plugin code to the plugin installer textarea and run the automatic setup. Then just activate the plugin and you are ready to use new tags that plugin includes like others.
For usage, basically just put <txp:mck_picasa > ... </txp:mck_picasa>
where you wont to show the Picasa Albums and structure the HTML output.
P. If you wont obtain a list of all PWA in Write section, you must set a custom field as picasa_album and set a mck_picasa_username as your Picasa Username in “advanced preferece“index.php?event=prefs&step=advanced_prefs
You may also want to grab a localization file, a textpack.
- Grab a localization textpacks from Kreatore website. There are few languages available.
- Copy and paste the textpacks contents to your site’s Language panel (TXP/Admin/Preferences > Language). At the bottom of the page you should see a Install Textpack field.
Language preinstalled are English and Italian
List of Tags and attributes
<txp:mck_picasa />
The mck_picasa
tag is a single or container tag that return the Picasa Web album Gallery. You can set the album and photo form for showing the images. Alternativly you can write code directly using else for split album from photo show.
If you not set any form or you not write as a container, it will print a predefined thumbnail linked to a galleryu for each album and picture linked to original in PWA for each pictures.
Attributes
user: Username of Picasa Web Album. Default: PWA Username set in advanced preference
thumbsize Size in px of thumnails in albums list and pictures list. Option:32, 48, 64, 72, 104, 144, 150, 160 Defalt:160
wraptag HTML wraptag of albums or pictures
break HTML break for albums or pictures
class CSS class attribute for wraptag
album_class CSS class attribute of each albums link and thumbanil if not use thing or form
photo_class SS class attribute of each pictures link and thumbail if not use thing or form
album_form Form used to show albums list
photo_form Form used to show pictures list
<txp:mck_picasa_album />
The mck_picasa_album
tag is a single tag that return the data of each album
Attributes
item Type of data to return. Options: name,published,thumbnail,title,numphotos Defalt:title
escape Convert special characters to HTML entities. Options: 1/0. Default:1
<txp:mck_picasa_photo />
The mck_picasa_photo
tag is a single tag that return the data of each pictures
Attributes
item Type of data to return. Options:picture,title,thumbnail Default:thumbnail
escape: Convert special characters to HTML entities. Options: 1/0. Default:1
<txp:mck_picasa_permlink />
The mck_picasa_permlink
tag is a single tag that return
Attributes
class CSS class attribute
title HTML title attribute
section Section to redirect
category Category to redirect
<txp:mck_picasa_if_first />
The mck_picasa_if_first
tag is a conditional tag and always used as an opening and closing pair. The tag will execute the contained statements if the displayed album or pictures is the first in the currently displayed list.
Attributes
type Item to check. Option: album,photo Default
<txp:mck_picasa_if_last />
The mck_picasa_if_last
tag is a conditional tag and always used as an opening and closing pair. The tag will execute the contained statements if the displayed album or pictures is the last in the currently displayed list.
Attributes
type Item to check. Option: album,photo Default
<txp:mck_picasa_single />
The mck_picasa_album
tag is a single or container tag that return the Picasa Web album of album set. You can set the album and photo form for showing the images. Alternativly you can write code directly. If you not set any form or you not write as a container, it will print a picture linked to original in PWA for each pictures.
You can use Custom Field name ‘picasa_album’ to simply chose the album you wont to show. In this case, this tag must be used into article form.
Attributes
user: Username of Picasa Web Album. Default: PWA Username set in advanced preference
thumbsize Size in px of thumnails in albums list and pictures list. Option:32, 48, 64, 72, 104, 144, 150, 160 Defalt:160
wraptag HTML wraptag of albums or pictures
break HTML break for albums or pictures
class CSS class attribute for wraptag
form Form used to show pictures list
photo_class SS class attribute of each pictures link and thumbail if not use thing or form
albumid The album to show. You can set the PW album code or using CF ‘picasa_ablum’ Default: CF picasa_album set into single article
Examples
All Picasa Albums
Display all albums and if album select (by click on image) show all pictures of this album
<txp:mck_picasa user="username" thumbsize="32">
<figure>
<txp:mck_picasa_permlink />
<img src="<txp:mck_picasa_album item="thumbnail" />" alt="<txp:mck_picasa_album item="name" />" />
</txp:mck_picasa_permlink>
<figcaption>
<p><txp:mck_picasa_album item="title" /><br />
<txp:mck_picasa_album item="numphotos" /><br />
<txp:mck_picasa_album item="published" />
</figcaption>
</figure>
<txp:else />
<txp:mck_picasa_if_first type="photo">
<h2><txp:mck_picasa_album item="title" /></h2>
</txp:mck_picasa_if_first>
</txp:mck_picasa>
Single Picasa Albums
Display all pictures of defined album. Each pictures is linked at original size
<txp:mck_picasa_single user="username" thumbsize="32" albumid="1234567890123456789">
<txp:mck_picasa_if_first type="photo">
<h2><txp:mck_picasa_album item="title" /></h2>
</txp:mck_picasa_if_first>
<figure>
<a href="<txp:mck_picasa_photo type="picture" />">
<img src="<txp:mck_picasa_photo />" title="<txp:mck_picasa_photo type="title" />" />
</a>
</figure>
</txp:mck_picasa>
Preview Album in differet section
Show a preview of an album and link to a gallery in different section. Set albumid and user by the article CF and the advanced preference
<txp:article_custom id="1">
<txp:mck_picasa_single thumbsize="64">
<txp:mck_picasa_if_first type="photo">
<h4><txp:mck_picasa_album item="name" /></h4>
<p><txp:mck_picasa_permlink section="galleria"><img src="<txp:mck_picasa_album item="thumbnail"/>" alt="<txp:mck_picasa_album item="title" />" /></txp:mck_picasa_permlink></p>
</txp:mck_picasa_if_first>
</txp:mck_picasa_single>
</txp:article_custom>
Changelog
- 0.1 Initial release
- 1.0 First release
- 1.1 Insert callback for plugin_ui
- 1.2 Use plugin_lifecycle for $prefs setting
- 1.3 Add mck_picasalight_random funciton
- 2.0 Rewrite all function and rename plugin to mck_picasa
TODO!
- Rewrite mck_picasa_random using array_rand()
- Add function to get all images of PicasaWeb Album into GalleryFromPicasa class.
- Add limit and offset at __mck_picasa_ and mck_picasa_single using array_slice()
- Add parameter for crop or full tumbnails
Thanks to
I must thanks to Pal Buczko for the GalleryFromPicasa class and Jukka Svahn for have showed me the correct way for write a plugin for textpattern.
I thanks to community of Textpattern for help in traslation of Textpack.
Marco Casalegno
Offline
Pages: 1