Jump to content


Easypeasygallery


  • You cannot reply to this topic
48 replies to this topic

#1 Nick_NP

    Etomite Forum Fan

  • Member
  • Pip
  • 72 posts

Posted 03 April 2005 - 11:30 AM

I have added a new snippet to the Snippet Library!

Snippet name: EasyPeasyGallery
Author: Nick_NP
Version: .5 (Beta)
More info: View this snippet
Description:
Easy to implement gallery snippet. Multi-paged thumbnail browsing + "Slideshow" style browsing. Just upload your pictures and you're away!

Please feel free to comment on this snippet, suggest improvements, or simply praise my work! ;)

[This is an automatically created message]

#2 Nick_NP

    Etomite Forum Fan

  • Member
  • Pip
  • 72 posts

Posted 03 April 2005 - 11:36 AM

Attached File  EPG.zip   2.84K   363 downloads

Using EasyPeasyGallery :
- Copy snippet code to a new snippet called EasyPeasyGalley
- Upload default pictures & CSS file
- Import CSS file in the header of your template : add '<style type="text/css">@import url('assets/site/mystyle.css');</style>' just before the '</head>' tag
- Create a new directory containing 2 sub-directories: 'thumbs' and 'large'
- Upload thumbnails to the 'thumbs' directory and full-sized pictures to the 'large' directory
- Call the snippet passing the new folder's name as an argument. Ex : [[EasyPeasyGallery?directory=<insert your folder's name here>]]

#3 EscapedApe

    Etomite Forum Newbie

  • Member
  • 25 posts

Posted 03 April 2005 - 04:03 PM

Nice one Nick, just what I was after and easy to set-up!

Cheers,
Troy.

#4 Robsta

    Likes Etomite Forums!

  • Member
  • PipPip
  • 360 posts

Posted 04 April 2005 - 02:45 PM

Excellent gallery. Nice and easy.

#5 Robsta

    Likes Etomite Forums!

  • Member
  • PipPip
  • 360 posts

Posted 05 April 2005 - 02:37 PM

If I wanted to automate a directory path for the images, how would I do this?

For example, in order to incorporate this into a template, setting [[EasyPeasyGallery?directory=gallery]] would mean all images (and 'Large' and 'Thumbs') would be located in the dorectory called gallery. However, in order to allow the splitting up of images to different images being relavent to different pages in the site, perhaps having an extra variable in the path name, say using the page alias name.

So, how would I add the variable from the database into the path used to find the images, so perhaps it would work like this ...

[[EasyPeasyGallery?directory=gallery&sub=alias]]

Images found here...

gallery/page_alias_1/
gallery/page_alias_2/

Thanks guys :)

#6 Nick_NP

    Etomite Forum Fan

  • Member
  • Pip
  • 72 posts

Posted 05 April 2005 - 07:30 PM

Robsta,

Not 100% sure of it, but I think I know what you mean.

I think your best bet would be to go and edit the snippet code.

Check to see if $directory has been assigned a value, if not assign the page's alias to it. That way you can still use the snippet in the original way.

A snippet call in the template would then go and look for the galleriy's pictures in the directory with the same name as the page's alias. Hence every page would automatically display its own specific gallery.

The line to add should look something like this :

if (empty($directory)) $directory = 'galleries/'.$etomite->documentObject['alias'];
(add it to the top of the snippet)

If that's what you wanted this should handle it! :rolleyes:

#7 Robsta

    Likes Etomite Forums!

  • Member
  • PipPip
  • 360 posts

Posted 07 April 2005 - 11:17 AM

That fab, thanks Nick :D . Will try it out later on today hopefully.

#8 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 07 April 2005 - 12:56 PM

I don't have an immediate need for this snippet, but would love to see it in action! Does anyone have a link to an example? (Perhaps it will motivate me to FIND an immediate need for the snippet :D )

#9 katherholt

    Likes Etomite Forums!

  • Member
  • PipPip
  • 323 posts

Posted 07 April 2005 - 02:59 PM

jaredc, on Apr 7 2005, 08:56 AM, said:

I don't have an immediate need for this snippet, but would love to see it in action! Does anyone have a link to an example? (Perhaps it will motivate me to FIND an immediate need for the snippet :D )

I tried this snippet, but it was no less work than what I'm already using with phpInstantGallery - so I stayed with my original. This snippet still requires making 2 directories and 2 images for each - I would be interested in a gallery that automatically makes the thumbnails and the ability to put captions under the larger pictures. Here are 3 galleries I'm using:

http://www.suttonscorner.org/showcase/inde...um&tmplt=museum
http://www.suttonscorner.org/showcase/inde...?gallery=photos
http://www.antiqueatticdothan.com/showcase...?gallery=bronze

phpInstantGallery - http://www.ikemcg.com/scripts/pig/ - you can also create different templates for each gallery.

#10 Nick_NP

    Etomite Forum Fan

  • Member
  • Pip
  • 72 posts

Posted 07 April 2005 - 04:01 PM

Jardc,

Sorry, for the mo I'm only working locally and my little bit of free webspace doesn't run any fancy things like php or mysql... My demo url will appear at the same time as the website I wrote it for.

#11 Nick_NP

    Etomite Forum Fan

  • Member
  • Pip
  • 72 posts

Posted 07 April 2005 - 04:04 PM

Katherholt,

If you have any ideas for making this gallery easier to use let me know!

It's not an ideal back-end but I've used in the past (and intend to carry on using!) a combination of local scripts to handle all the image resizing etc... Basic stuff for moving the files around to the right directories, then Image Magick to resize/convert/tamper with the images followed by a simple ftp script to upload them.

All these things could be done via a "gallery admin page" snippet, but for me the effort of writing all that grossly outweighs the hassle of using it, for it's intended use, as it is. I'll put it on my "I'll-do-it-if-&-when-I've-got-the-time" list! Same goes for the captions! :rolleyes:

#12 Robsta

    Likes Etomite Forums!

  • Member
  • PipPip
  • 360 posts

Posted 12 April 2005 - 01:04 PM

Nick_NP, on Apr 5 2005, 08:30 PM, said:

The line to add should look something like this :

if (empty($directory)) $directory = 'galleries/'.$etomite->documentObject['alias'];
(add it to the top of the snippet)

If that's what you wanted this should handle it!  :rolleyes:
Hi Nick, this bit of code didn't work. Also unable to use a 2 directory path using the standard snippet, (ie using 'galleries/this_item'). Generates a parse error relating to permissions. The path appears correctly, and the directory has CHMOD 777 on all image directories and images. Simply removing the '/this_item' from the snipped allows it to work (thumbs and large present in both locations).

One side effect, not sure how to fix this. If I insert an image, assigning it to the left so the text appears along side it, the gallery vanishes off the page. For example, I have three images in the gallery, 2 are show and the third is only just shown when the page is maximised. Why is it the gallery doesn't just work around the graphic within the bounds of the content area?

With regards to making this snippet better (as mentioned in the post above), something that would be better would be when the larger image is being viewed, having the 'Next/Previous/Back to Gallery' options at the top of the image as well as the bottom.

Thanks.

#13 Nick_NP

    Etomite Forum Fan

  • Member
  • Pip
  • 72 posts

Posted 12 April 2005 - 01:31 PM

Hi Robsta!

This should work :
if (empty($directory)) $directory = 'galleries/subdirectory/'.$etomite->documentObject['alias'];

This shouldn't :
if (empty($directory)) $directory = 'galleries/subdirectory'.$etomite->documentObject['alias'];

The lack of a trailing slash may be the cause of the problem.

NB : there isn't yet much error checking, if the $directory variable is filled with a path that doesn't exist, it WILL crash the gallery and generate a parse error like the one you described.

I'll try to add the other feature you requested within the next few days. Quite busy at the mo so can't make any promises!

Hope this solves your problem!

#14 Nick_NP

    Etomite Forum Fan

  • Member
  • Pip
  • 72 posts

Posted 12 April 2005 - 01:42 PM

Sorry, missed a question there!

Hard to say without seeing what's going wrong with the positioning but you should know that the CSS file that I provided wasn't intended to be generic, you'll probably have to adapt it to your context.

#15 Robsta

    Likes Etomite Forums!

  • Member
  • PipPip
  • 360 posts

Posted 12 April 2005 - 01:47 PM

Bit confused.

if (empty($directory)) $directory = 'galleries/subdirectory/'.$etomite->documentObject['alias'];
How should this snippet be called to use the 'alias' name as the variable directory name?
If this is code in the snippet, is this path hardcoded? What I'm trying to acheive is calling this... [[EasyPeasyGallery?directory=your_directoy]] then your extra change using the alias name the path changes to 'your_directoy/alias'. Or should is just be called using [[EasyPeasyGallery]] ?

In calling the original snippet (without the 'alias' edition ... [[EasyPeasyGallery?directory=your_directoy]] works, however [[EasyPeasyGallery?directory=your_directory/subdirectory]] doesn't with Parse error (error 2), also adding a trailing slash doesn't work (double slash appears in the Parse error).

#16 Robsta

    Likes Etomite Forums!

  • Member
  • PipPip
  • 360 posts

Posted 12 April 2005 - 01:49 PM

Nick_NP, on Apr 12 2005, 02:31 PM, said:

NB : there isn't yet much error checking, if the $directory variable is filled with a path that doesn't exist, it WILL crash the gallery and generate a parse error like the one you described.
The path does exist though :blink:

#17 Nick_NP

    Etomite Forum Fan

  • Member
  • Pip
  • 72 posts

Posted 12 April 2005 - 02:03 PM

OK, let's start again :
- In your Etomite root create a directory called 'galleries'
- Within that directory create a subdirectory for each page : each name should be the same as the page's alias
- Fill each of these directories with the 'thumbs' and 'large' directories containing the page's respective pictures
- Add this line to the top of the snippet :
if (empty($directory)) $directory = 'galleries/'.$etomite->documentObject['alias'];
- Add the snippet call without any arguments : [[EasyPeasyGallery]] , you can even add it to your template as long as you have a valid gallery directory for each page (this is what I thought you originally wanted).

If this still doesn't have the desired effect I'm going to have to ask you to explain again!

Run a couple of brief tests on my etomised site and seemed to come out OK

#18 Robsta

    Likes Etomite Forums!

  • Member
  • PipPip
  • 360 posts

Posted 12 April 2005 - 03:08 PM

Yea, this is exactly what I am after, I really appreciate your help.

And may I just add... DOH! The 'alias' directory was CHMOD to 766. Changed to 777, and seems to work now.

Thanks for your help Nick, it's a great gallery snippet. :D

#19 Nick_NP

    Etomite Forum Fan

  • Member
  • Pip
  • 72 posts

Posted 12 April 2005 - 03:26 PM

Phew! :P

Glad it's working for you!

#20 Nick_NP

    Etomite Forum Fan

  • Member
  • Pip
  • 72 posts

Posted 18 April 2005 - 10:10 AM

I have updated this snippet in the Snippet Library!

[This is an automatically created message]

Added second nav bar to the details page + ability to toggle both nav bars on/off.
CSS has been updated to cater for new elements!

Attached Files

  • Attached File  EPG.zip   2.84K   134 downloads






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users