This isn't a patch as it's a complete module, but it does need work. :) We've been waffling between making a seperate project for this or adding it to the gallery.module tarball. In the mean time, I have people emailling me asking for a copy, so I decided to make a temporary home for it.

This module was originally written by me based on the image filter module. Other people have contributed to it, the latest being Keizo. At this point, I don't have time to work on it further or support it. I am hoping to get back to it early next year, but I have no problem with someone taking it over. It is, of course, completely GPL.

What this module is for is to allow you to put (at its most basic form) [G2:999] to have the item in Gallery 2 with the item ID 999 appear in a node.

It mostly works, but there are a few issues:

1) Frames stopped working somewhere between versions and I haven't figured out why.
2) Recently, I noticed that pages with more than one node using this filter show badly formed links instead of the thumbnails whereas clicking on a single node shows the thumbnail fine.
3) Keizo's changes have not been worked into the readme file and I've only briefly looked at them and not given them a good test.
4) The code has gotten messy and needs to be cleaned up again.

There is more I wanted to do with this, and there are some notes in the todo.txt. I also wanted this to be part of a larger module that would have img_assist like functionality. But, for now, this is what I have. Take it, play with it, run with it if you want. If you make any changes, please upload them back into this issue so others can benefit. Please keep any support requests here as well.

Hopefully I'll have more time for this after the hollidays.

Enjoy,

Michelle

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Michelle’s picture

Priority: Critical » Normal

Whoops, the priority really isn't critical. :)

Michelle’s picture

Wish I could edit my post... Just remembered to add that this does not work with 4.7. The only form is on the settings page, so it shouldn't be hard to update it, but it hasn't been done, yet.

Ok, that's all I can think of for now. :)

Michelle

walkah’s picture

Status: Needs work » Fixed

Thanks Michelle! I've gone ahead and committed this to hopefully make it easier to find for folks.

Thanks so much for your continued efforts and dedication to the integration :)

Michelle’s picture

Um, commited it where? Maybe it's just because I don't know the project module very well, but I'm not sure how committing applies in this case...

I wish I could have continuing dedication. Unfortunately, my computer time is down to hardly anything as of today so I don't know when I'll be able to work on this again. It might not be for some months. :(

Thanks,

Michelle

kiz_0987’s picture

Michelle,

It's in the CVS (gallery/contrib) at http://cvs.drupal.org/viewcvs/drupal/contributions/modules/gallery/contr... or go to the gallery module page http://drupal.org/project/gallery and click "Browse the CVS repository".

Great that this is now officially here. I've been using a previous version for a while now and it worked very well. Thanks for all the excellent work.

Waldemar’s picture

Status: Fixed » Needs review
FileSize
12.04 KB

Thanks very much for g2_filter, MichelleC! It's great. I have converted it to drupal 4.7 and G2 CVS (the new debug pattern), So It will work, once G2.1 is out. I could supply a current G2 version if anyone needs it. It would be great if somebody could review/test. I am supplying the whole module-file and not a patch, as I did substancial cleaning up in the tabbing, so almost every line has changed.

Changes include:
* New Forms API
* Corrected relative_G2_path to use variable from gallery.module (as it defaults to / otherwise)
* Lots of tabbings/spacings
* Removed commented out text

It is certainly not finished yet, but it is a start, I think...

Waldemar’s picture

FileSize
16.59 KB

I didn't really just post the old file :( SORRY! Why does it always happen that I can't supply a file correctly the first time ;) And I want to be able to edit my posts! I hope some drupal people hear this :) Anyways, here's the right one.

Waldemar’s picture

By the way, the frames stopped working because of the wrong relative_g2_path and hence no CSS. It works now again.

walkah’s picture

can you please provide just a patch of the changes?

http://drupal.org/diffandpatch

thanks... makes it much easier for me to see what's changed, etc.

Waldemar’s picture

FileSize
35.77 KB

Walkah,

As I mentioned I don't think the patch will help you much, as almost every line was altered, because of the indenting issues. However as you asked for it, I am attaching it here as a file.

Waldemar

pcguy’s picture

Version: 4.6.x-1.x-dev »
Component: Miscellaneous » Code
Category: task » support

I am running drupal 4.5.3

and got g2_filter.module working (not sure what version) but after i upgraded to Michelle's version it broke.
for this input in comment box (13 being valid image id as far as i can tell):

this is a test [G2:13] image

it creates this output:

<div class="content"><link rel="stylesheet" href="/gallery/main.php?g2_controller=imageblock.ExternalCSS&amp;g2_frames="/> <link rel="stylesheet" href="/modules/g2_filter.css"/> <p>this is a test <div class ="giImageBlock nowrap"></div> image</p>
</div>

and for Waldemar's version the same input gives blank div:
<div class="content"></div>
and i can't get the old version to work, how do i reset all settings form g2_filter?
or how can I get current version of g2_filter to work?

Thanks

Michelle’s picture

Walkah - Sorry for the lateness of this. I haven't been monitoring this for a while. It sounds like Waldemar made considerable changes and I have no problem with making his the "official" version. If we go that route, though, it would be good if he backported it to 4.6 and G2.0 for those who haven't upgraded yet. If I ever get back to working on this, I'll grab his code and go from there.

pcguy - First of all, this won't work on the 4.5 series of Drupal. You need 4.6. Possibly that was a typo seeing as how you had it working at one point?

I'm a bit confused by your post. You said you "upgraded" to my version and you can't get the old version to work. That doesn't make sense as I'm the original author. The version I posted in this thread is mine plus changes made by others included in it. That version works in 4.6 with G2.0 other than the issues I mentioned.

Waldemar's version is for 4.7 and Gallery 2.1.

I don't know why it's outputting a blank div, unfortunately, but do make sure you are trying to use the right version of the filter with the right versions of both Drupal and Gallery.

Michelle

pcguy’s picture

Michelle,

yes one of versions of g2_filter.module (that had css file) that i got from this site worked fine with drupal 4.5.3 (and since there is no version numbering inside the module file it is had to say which one it was.) There was one change that I had to make. Had to hard code "/modules" location for g2_filter.css since there is not such function in 4.5.3

drupal_get_path('module', 'g2_filter')

but after the upgraded I reverted to previous version of g2_filter.module but it also didn't work.
Maybe some of the setting remained from new version and interfere with old version and that is why when i tried old version it didn't work anymore. Where the configuration for modules are saved, is there a way to clear them?
And does g2_filter.module need gallery.module (I changed it's version as well but it integrates fine with drupal so don't think it has to do with g2_filter problem)

Michelle’s picture

pcguy - This module was never intended to work with versions before 4.6. I've never used anything other than 4.6 so there's no way I can even try it in earlier versions. If it did work, then it's probably because this is a pretty simple module and maybe the part of the code it uses hasn't changed. Unfortunately, that means there's no guarantee it will continue to work as the module is improved, as you found out.

Where did you get the module from originally? Before this post, it was only being passed out in email. I put it up here to make it easier for people to find.

You could try clearing out all the g2_filter rows in the variables table before reinstalling the old version.

Yes, this does require gallery.module. That's why it's posted into that module's area. It's more of an add-on to that than a module of its own.

Michelle

nemot’s picture

Hi all,

I'm glad I finaly stumbled on this module - is something really useful to include my Gallery album images in different parts of my sites.

Waldemar: you mentioned that your changes were done to make the module work with Drupal 4.7 and Gallery 2.1 (CVS) - would it be possible to also provide a version that works with Drupal 4.7 and Gallery 2.0.2 (I don't want to go to the Gallery CVS version as long as the Gallery integration module doesn't support it yet, and I'm not Gallery experienced enough to adapt your module myself...)?

Thanks in advance,

Nemot

KarenS’s picture

I can't get this to work -- when I type [G2:297] into a text area, it just shows me the text I typed in. It's probably that I don't understand how to turn the filter on. I am using cvs version of everything, G2 integration works just fine, just can't get this filter to work.

KarenS’s picture

Got this fixed -- it was a small problem in the code plus a misunderstanding from the documentation:

I am using the altered code for the cvs version (attached earlier in this thread). On line 368 you need to change:

if ($ret) {
gallery_error(t('Unable to get Gallery image block'), $ret);
return;

to:

if ($ret->isError()) {
gallery_error(t('Unable to get Gallery image block'), $ret);
return;

The document misunderstanding is in install.txt where it says:

"Add the filter to at least one of your input types at /admin/filters"

In 4.7 you need to go to admin/input formats (not admin/filters) and configure an input type to include the g2_filter

With those changes it works great. Thanks!!

KarenS’s picture

Meant to say I am using the g2_filter for Drupal 4.7 as posted above. I am using Gallery 2.0.2 and it seems to work fine. I don't think any of the Gallery 2.1 changes affect the operation of the filter, unless it relates to the following problem:

I can't get it to show images larger than my gallery-configured default thumbnail size (150). I have tried adding show=fullSize, size=640, and maxSize=640 inside the [] brackets, but none seem to work. I can add class=myclass and that works, so it is picking up some variables added inside the brackets. I also tried increasing the default size in my g2_filter settings to 640 with no noticable effect, I cleaned out the template cache in Gallery admin/maintenance, and I changed the image I was selecting in case it was still caching the smaller size from an earlier call. Anyone have any other ideas??

KarenS’s picture

Sorry to keep posting, but I keep figuring out my own answers and I assume others are looking for the same things so I'm trying to help out by logging what I find.

Here's what finally worked for me (using Drupal 4.7, Gallery 2.0.2, and the Drupal 4.7 version of the g2_filter posted above):

1) Make the previously-noted change to the g2_filter:

On line 368 you need to change:

if ($ret) {
gallery_error(t('Unable to get Gallery image block'), $ret);
return;
to:

if ($ret->isError()) {
gallery_error(t('Unable to get Gallery image block'), $ret);
return;

2) enable the g2_filter in the modules directory and in admin/input formats (configure filtered html or some other format).

3) go to g2_filter settings. If you will ever want any full size photos you MUST check the box "Full Size" under "Default Image Block Settings". You can then request smaller photos by using something like [G2:97 size=150] or get full size photos by not specifying a size in the brackets. There is a bug/quirk in the code somewhere (don't know where), but if you don't check that box you cannot get full size photos to display later. With it checked, you can get photos of any size to show up in any node by specifying the size when you use the filter.

4) add something like [G2:97 size=300 class=myclass n=2] to any node. and you should see the specified number of pictures at the specified size.

Hope this helps.

chrisd’s picture

This new version seems to be working fine for me on 4.7.0B4 and Gallery 2.0.2 (the latest released version: not CVS version)

For pcguy...I initially had the same problem.
Make sure you use the orginal images id.

When you click the "Edit" image in G2, look at the URL and grab the value of g2_itemId. In this example its 79.

/g2/main.php?g2_view=core.ItemAdmin&g2_subView=core.ItemEdit&g2_itemId=79&...

tangibre’s picture

I can't get this to work. Posting here to share my experiences and hopefully get some tips as to how to solve the problem.

  • First I tried the cvs-version, then I tried the various versions in this issue-thread, ending with the one of Waldemar. The first problem was to figure out that I had to guess the settings url, as admin/settings/g2_filter didn't show up on the admin menu.
  • Then, the first versions of the settings page showed the "Save configuration" and "Reset to defaults" buttons only, without any actual settings displayed. That was solved with Waldemars version
  • I have defined input formats including the filter, but when I try to use the filter the resulting page/story is showed with the [] tags removed, but without any substituted image. When I look at the source code, there are nothing there.

I'm using Drupal 4.7b4 with gallery 2.02 embedded with clean urls.
When I look at my logs I have this:

Unable to get Gallery image block
Error (ERROR_CONFIGURATION_REQUIRED)

    * in modules/core/classes/GalleryEmbed.class at line 764 (GalleryStatus::error)
    * in /example.com/modules/gallery/contrib/g2_filter/g2_filter.module at line 367 (GalleryEmbed::getImageBlock)
    * in /example.com/modules/gallery/contrib/g2_filter/g2_filter.module at line 185
    * in /example.com/includes/module.inc at line 171
    * in /example.com/includes/module.inc at line 171
    * in /example.com/modules/filter.module at line 728
    * in /example.com/modules/node.module at line 560
    * in /example.com/modules/node.module at line 536
    * in /example.com/modules/node.module at line 572
    * in /example.com/modules/node.module at line 2021
    * in /example.com/includes/menu.inc at line 414
    * in /example.com/includes/menu.inc at line 414
    * in /example.com/index.php at line 15

Is this related to the general gallery module rather than to the g2_filter, or what?

tangibre’s picture

Never mind. I figured out that I had to activate the "Image block" within Gallery.

tangibre’s picture

A quick question:

Is Gallery caching the rescaled images, or are the images generated on the fly? It seems to take some time to display.

Nice module!

Michelle’s picture

I asked a Gallery dev (since I'm just using their functions and don't know how they work) and this is what he says:

getImageBlock returns the fullsize when you specify a maxSize. it's scaled in html. no new resize is created.

So I guess there's nothing to cache. If it's a large image, that could be why it's taking so long.

Michelle

Continental’s picture

hi huys, this module is very interesting, but I see the some further imporvmenst (may be they're dublicate in todo.txt), but nevertheless. Please, don't take it serious, that's I'm really looking for, I apreciate your work, but I just try to show my opinion on all it in order to somebody in the future will listen to it and may be improve. =)

My situation in currently as follows:
I use geturls module for G2 and under each picture have almost four html codes.
I have different sizes: thumbnail 100, middle 320 (to put in text) and some langer to show in gallery
I just copy html-code and paste it into node.

Advantage:
- I can point to any size which is created before (110, 320, 640 e.t.c.)
- I use premade sizes, so they're good picture quality

I install your module, of course it's much easier to insert just [g2:id] but for my situation:
- quality of fullsize+size=320 is awful. it has been resizing (?) from 1024 and it's awful. you need an option to get already prebuild resized image according to what gallery has (user set).
- some nodes are much text inside and more 10 pictures inside. So, it could be time to download all fullsized pictures if I use imageblock with fullsize more than thumbnail
- for the node I already use the first picture from the gallery. it's thumbnail. but it doesn't have a link to somewhere in gallery, but only to the node inside. it's easier to press on picture and read full story from the main page. with your filter I can't change link to this way
- there is no way for user to get know what id each picture has. only admins can or very clever users. I could easily show it in template, but I need to think how to do it. Many be smbd provide instruction?

If the the dev. of this module wish to continiue I can pm my link with node example how it look like now at my site. that's a big problem for users to insert pictures into nodes by themselves currently. =( to I'm looking forward to developing this pretty module.

Michelle’s picture

Sorry, Continental, I missed this post.

I agree that there are a lot of issues with this module. Unfortunately, I don't have the time to work on it for the forseeable future. If someone wants to jump in and improve it, that's great but, otherwise, it's sort of in stasis.

Michelle

kiz_0987’s picture

Status: Needs review » Closed (fixed)

The code has been included for ages. Most of the requested updates are also included.