Using Gallery ext. for portfolio, would be nice if it can...

Discuss PivotX 2.0.x extensions here, and view extensions that are available for download.

Using Gallery ext. for portfolio, would be nice if it can...

Postby xzjia » Tue Oct 20, 2009 2:02 pm

One of my friend was thinking of setting up his portfolio site, so nothing really complicated, and not a large blog by any means, so he's asked me what CMS he should use, since he thought Wordpress is overkill for the tiny site and theme templating doc is a beast to go through that it doesn't seem to worth the hassle.

I told him that PivotX is a really good choice, since it uses flatfile (no database setup) and Smarty for templating. Not that I got anything against PHP, just that with PHP you got the logic of the template obscured by too much raw code, making something that should be clear and obvious looking very obtuse.

Anyways, everything is fine and dandy except when it comes to putting portfolio items on the page, namely, the images and the descriptions. Right now the Gallery extension do not provide any extra field to attach more information to the list of images on display, so we're shit out of luck.

The way things were laid out is like this:

Project 1, Project 2, Project 3, Project 4... (Each project is an entry using extra image field to attach an identifying image to the entry)
Gallery extension (Showing a bunch of images for each project)

The problem is of course that the gallery extension does not hold any data for each image, forcing us to feed only the title information through the filename.

Lots of people set up portfolios, and I think PivotX, with the simplicity and flatfile support would be perfect for those people, except that it needs better feature in the gallery extension to handle portfolio items:

  1. Title field for each image (Not absolutely necessary, but editing raw file names seems like such a hack)
  2. Description field for each image
  3. Instead of extra image field, be able to call specific images from the gallery of said entry instead. So if the image you want to represent the entry is going to be in the gallery anyways, why duplicate it? Just call it from the gallery: "I want the first image from gallery of this post", or specify the title, or make it an random image from the gallery.

Right now we're hacking the installation so it work like this:

(Project 1) Entry Page
------> Subweblog category = Project 1
--------> List of entries acting as gallery items, with title and description as Title and Intro, using Extra Image Field for the image

Looking at the above, it is such an ugly solution, and the backend management is a mess, but it works, for now.
xzjia
 
Posts: 110
Joined: Tue Dec 11, 2007 6:26 pm

Re: Using Gallery ext. for portfolio, would be nice if it can...

Postby hansfn » Tue Oct 20, 2009 11:06 pm

OK, I have improved the Gallery extension:
  1. You can specify a title and/or an alternative text (description) for each image in the gallery (but only when you add them). If none is provided we use a nicely formatted version of the filename as title and alt text.
  2. You can use any of the images in the Gallery as a preview (outside of the Gallery) with the help of the [[gallery_image]] template tag.
  3. You can use already uploaded images in the Gallery in stead of only newly uploaded images.
NB! You need to upgrade to the very latest version of PivotX - get it from http://pivotx.net/files/unstable-development/

An updated example for the gallery block tag can be found in the beginning of the file extensions/gallery/hook_gallery.php. Typical usage of the gallery_image template tag is (if you want a thumbnail):

Code: Select all
<img src="[[pivotx_dir]]includes/timthumb.php?src=[[ gallery_image ]]&amp;w=106&amp;h=80&amp;zc=1" />

Parameters for gallery_image is "number" - the position in the gallery starting from 0 (default) - and "attr" - the attribute for the image; "src" (default), "title" or "alttext". In other words, "[[ gallery_image ]]" is equivalent to "[[ gallery_image number=0 attr=src ]]"

Hope this helps!
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Using Gallery ext. for portfolio, would be nice if it can...

Postby xzjia » Wed Oct 21, 2009 3:52 am

It is late so I'm going to implement tmr but holy sh!t, this is totally unexpected speed!

Mad props!!!!

Now PivotX is perfect for publishing portfolios, esp. with the unconventional but flexible Chapter / Page / Entry back-end organization system.

Edit: Just saw improvement #3 "Able to use already uploaded images". Niiiiice, that's like the last major usability / management hurdle for the Gallery ext. I bet many ppl would be rejoicing.
xzjia
 
Posts: 110
Joined: Tue Dec 11, 2007 6:26 pm

Re: Using Gallery ext. for portfolio, would be nice if it can...

Postby hansfn » Wed Oct 21, 2009 8:31 am

I just fixed two minor bugs (in revision 2182).

PS! When you download pivotx-latest.zip, it is recommended to also grab pivotx-latest.txt which tells you what version you got.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Using Gallery ext. for portfolio, would be nice if it can...

Postby xzjia » Wed Oct 21, 2009 3:01 pm

Uploaded, and tested. Everything seems to be working fine.

Figured out that %title% and %alttext% can be used to invoke the attributes while in the [[ gallery ]] tag, which means finally descriptive caption is possible without messy filename hack.

Now everything needed is in, rock on!

I almost feel guilty to voice more suggestions, however it seems that those fields are only in the upload box, meaning there's no way to edit or add those attributes without deleting images and re-add them back in. Is it possible to edit the attributes of existing images?

Possible future convenience feature: when selecting already uploaded files, being able to select multiple images at a time (like in the upload box), and / or being able to select a folder to get all image contained, so you can create an gallery by ftp a bunch of images into its own folder, then select said folder, Voilà
xzjia
 
Posts: 110
Joined: Tue Dec 11, 2007 6:26 pm

Re: Using Gallery ext. for portfolio, would be nice if it can...

Postby hansfn » Wed Oct 21, 2009 9:42 pm

Is it possible to edit the attributes of existing images (in the gallery)?

No, you have to delete and re-add.

Selecting multiple images doesn't make sense as long as you only can set one title/description.

Both of these limitations is a result of lack of time. Sorry.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Using Gallery ext. for portfolio, would be nice if it can...

Postby xzjia » Wed Oct 21, 2009 11:49 pm

It's ok, it works as it is.

Thanks again!
xzjia
 
Posts: 110
Joined: Tue Dec 11, 2007 6:26 pm

Re: Using Gallery ext. for portfolio, would be nice if it can...

Postby Harm10 » Sat Oct 24, 2009 5:05 pm

hansfn wrote:
Code: Select all
<img src="[[pivotx_dir]]includes/timthumb.php?src=[[ gallery_image ]]&amp;w=106&amp;h=80&amp;zc=1" />
I've tried this enhancement and it works fine!
Only when I use it in Internet Explorer on a post where there is no gallery attached an empty placeholder is shown while the same post in Firefox shows nothing (which is what you want). Is there a way to bypass this problem e.g. with some kind of [[ if ]] ?
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2011
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: Using Gallery ext. for portfolio, would be nice if it can...

Postby Harm10 » Sat Oct 24, 2009 7:03 pm

Found it!
Use
Code: Select all
[[ if (!empty($entry.extrafields.galleryimagelist)) ]]
<img src="[[pivotx_dir]]includes/timthumb.php?src=[[ gallery_image ]]&amp;w=106&amp;h=80&amp;zc=1" />
[[ /if ]]
to only activate the gallery_image coding when there is something in the entry's galleryimagelist.
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2011
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: Using Gallery ext. for portfolio, would be nice if it ca

Postby bwklein » Fri Jul 23, 2010 6:17 pm

Is there a way to use the Gallery tag, and to have it only show a single image from the gallery?
I see how to use the [[gallery_image]] tag, but that only works outside the [[gallery]] tag.

What I am thinking is something like what you can do in the [[gallery_image]] tag, with the parameter 'number=0'.

Code looking something like this in a page template to show one bigger image for the link to popup the fancybox:
[[gallery popup="fancybox" number=0]]
<a href='%imageurl%%filename%' class="fancybox" title="%title%" rel="gallery-%uid%" >
<img src="%pivotxurl%includes/timthumb.php?src=%filename%&w=320&h=240&zc=1" alt="%alttext%" />
</a>
[[/gallery]]

Am I missing something obvious?
bwklein
 
Posts: 11
Joined: Fri Jul 23, 2010 4:11 pm

Next

Return to 2.x Extensions

Who is online

Users browsing this forum: No registered users and 4 guests

cron