Feature #551

[FEATURE] Image gallery added

Added by typo-grundprinzip-de - 957 days ago. Updated 296 days ago.

Status :New Start :
Priority :Normal Due date :
Assigned to :tobi - % Done :

0%

Category :frontend
Target version :-
Resolution :


Description

Hi,

I wrote a small filter for adding some image gallery functionality to Typo. For adding a simple gallery to your blog just type the following content in the edit article textfield.

gallery_begin[thumb=true,width=100]
url_to_image:title
url_to_image:title
gallery_end

The thumb option tells the plugin to display first a thumb and then link to the large image. The width option determines the width of the thumbnail.

You can download the Typo Gallery from my website here: http://blog.grundprinzip.de/files/typogallery.rar

Associated revisions

Revision 1077
Added by scott 730 days ago

Greatly improved XSS filtering for comments. Closes #551

Revision 763
Added by scott 945 days ago

Really, really strip Javascript from comments. Closes #551

History

11/21/2005 02:25 PM - scott -

Cool. I'll think about adding this (or something similar) after Typo 4.0 is released.

12/13/2005 06:18 AM - clarsen-ilanyo-com -

Rather than creating a new ticket, i'll just add some comments here.

  • An existing file upload and manipulation mechanism (such as ftp or DAV) should be encouraged instead of a sophisticated admin interface, similar to how WYSIWYG blog editors are currently supported through XMLRPC APIs.
  • How should image data be arranged in filesystem? All in one directory, grouped by gallery or date or just arbitrary layout and location?
    • Generated or derived images such as thumbs should be stored separately from the pristine source images so that we can clean them up and not delete source content by accident.
  • Image tagging could be
    • a) stored in database table using something as a key (pathname to the base/non-thumb image?)
    • b) stored along side image in a file making easier manipulation outside of admin interface, but making tag queries slow.
    • "a" seems better
  • Thumbs could, maybe should be generated automatically.
  • Alternatively, should we even try to "solve" the image gallery problem, or instead provide a configurable means of enumerating and laying out a group of images that may be stored somewhere else, e.g. in some other photo sharing and grouping site such as flickr, pbase, smugmug.

Looking at 's implementation, we assume big images and thumbs have already been uploaded somewhere and URL paths are enumerated by hand in between gallery_begin/gallery_end "tags".

Building off of this, to keep in spirit of typo's textfilter plugin mechanism, e.g. the flickr "macro", you'd have:
#!xml
<typo:gallery  ...some attributes here such as... thumb="true" width="100">
maybe the image definitions...
</typo:gallery>
I'll try to add comment about repurposing of (and exposing of tags) of images not stored locally, i.e. stored elsewhere. The intention is same as the original feature description:
allow authors to post images much like a blog entry, complete with a 
description category and tags
** category and tags would be blog assigned, possibly initially read from the photoshare site's tags, although I imagine rather than embedded in macro tags in the article entry, the category and tag assignment per image would have to be given an admin interface for easier manipulation.
a filtered view should be available to view just the photo posts, and with
category/tag posts something resembling photo albums should be achievable
without any additional effort 
** A gallery macro tag should allow you to specify that a gallery of images with a particular tag are expanded in place.

12/15/2005 10:57 AM - grundprinzip -

Hi,

I've changed the structure of the plugin, so that is available by now as a Textfilter Macro. This allows the easy usage of the gallery like described above. As I changed the plugin I added the functionality, so that thumbnails are generated automatically.

The plugin can now be used like the following:

 #!xml
<typo:gallery  thumb="true" width="100" folder="sample" gen_thumb="true">
image.jpg:Alt Text
</typo:gallery>

These set options specify, that the gallery uses thumbnails that are automaticallly created and have a size of 100px. The images are available at: RAILS_ROOT/public/images/sample, where sample is the name of the folder specified by the attribute.

All available options are described in the help text of the text filter.

12/16/2005 10:12 AM - kuba-lbl-pl -

hi. i just made gallery almost working, images finally show up in article but they don't appear as thumbnailed
text that i enter inside article is:

![test image](http://kuba.lbl.pl/oaza.jpg) #this works

<typo:gallery thumb="true" width="100" folder="" gen_thumb="true">
files/bank6eh.jpg:Test
</typo:gallery> #this also works but no thumbmail is mage (RMagick works)

you can see that in action on :

http://www.freezenet.pl:3000/articles/2005/12/15/obrazek

can anyone help ?

12/16/2005 10:49 AM - grundprinzip -

Set the folder attribute to files then it should work. The filename in the list should be without any foldername inside.

12/16/2005 11:23 AM - anonymous -

nowa i have this:

<typo:gallery thumb="true" width="100" folder="files" gen_thumb="true">
files/bank6eh.jpg:Test
</typo:gallery>

this also displays the image but still no thumbnail, when i enter "bank6eh.jpg:Test" instead if "files/bank6eh.jpg:Test" it does not display the image. (just looks like folder attribute is not working).

12/16/2005 11:25 AM - anonymous -

when i set folder attribute to "files" and just bank6eh.jpg:Test without folder name i get in log:

Processing RedirectController#redirect (for 217.116.98.2 at 2005-12-16 12:24:05) [GET]
Parameters: {"from"=>bank6ehjpg, "action"=>"redirect", "controller"=>"redirect"}
Completed in 0.00381 (262 reqs/sec) | Rendering: 0.00006 (1%) | DB: 0.00111 (29%) | 404 [http://www.freezenet.pl/bank6eh.jpg]

this proves more with not-working folder attribute.

12/16/2005 12:00 PM - grundprinzip -

Maybe its a lack of documentation from my side. The folder files must be under the images folder. This is to follow the folder structure of typo. An idea is:

1) Move the images to the images folder create a subfolder "files"
so that the folder structure looks like:
RAILS_ROOT/public/images/files

2) Within the images/files folder put now your images.
3) This then should work fine.

Hope this helps.

Martin

12/16/2005 12:07 PM - kuba-lbl-pl -

still no difference. now i have in article:

<typo:gallery thumb="true" width="100" folder="files" gen_thumb="true">
bank6eh.jpg:Test2
komora1.jpg:Test1
</typo:gallery>

ls /usr/local/typo/public/images/files says:
bank6eh.jpg komora1.jpg

so right files exist in the right place and no effect.
even if i directly go to :
http://freezenet.pl:3000/images/files/komora1.jpg
i see an image but inside article i see nothing and no thumbnail.

12/16/2005 12:17 PM - grundprinzip -

Ok, I will check the soruce code. But one last question: Do you have the read and write rights correctly set?

Regards,

Martin

12/16/2005 12:40 PM - grundprinzip -

Shame on me... the script had some problems with the type conversion thatswy you got problems. I attach new new gallery to the ticket.

Regards

Martin

12/16/2005 08:09 PM - kuba-lbl-pl -

sorry but still nothing happens. in my log i still see 404 errors when accessing files

12/20/2005 05:56 AM - jsquires -

While trying to get this run has been a bit of a chore :). Being a complete N00b to Typo (only been using it for 2 days), I found that unless you have RMagick installed the gallery_controller.rb will prevent certain parts of your admin interface (the ones that grab the list of textfilters) from running.

I think you might want to add in some code similar to the "sparkline_controller.rb" file. I will try to get around to doing that after messing around with Typo and the gallery a bit :).

Thanks for the wonderful work on what's here so far :).

12/20/2005 07:26 AM - grundprinzip -

Thanks for the tip. I added now a

rescue LoadError 
part so that the plugin will not break the whole system if RMagick is not installed.

12/21/2005 05:00 AM - clarsen-ilanyo-com -

These changes are presented as a patch against trunk r801. This incorporates gallery_controller.3.rb

Added functional tests for the gallery_controller.
Added "target" attribute to allow a new window (or frame) to be populated on click of image.

Also available in: Atom PDF