Gallery3 media picker for Wordpress

kandsten

Joined: 2010-11-26
Posts: 79
Posted: Fri, 2010-11-26 19:13

Greetings,

I'm sure a few people here run both Wordpress and Gallery. I whipped together a gallery3 media picker for WP, allowing you to browse and import G3 media into WP. It's sort of feature complete for the time being, but could do with a bit more in terms of port, polish and real world testing, especially by users with very large galleries.

http://wordpress.org/extend/plugins/gallery3-picker/

 
ckdake
ckdake's picture

Joined: 2004-02-18
Posts: 2258
Posted: Sun, 2010-11-28 19:29

Thanks kandsten! I added a link to this to:

http://codex.gallery2.org/Category:Gallery_3:Other_Clients

PM me your shipping info and t-shirt size if you'd like a Gallery t-shirt!

____
http://ckdake.com/ - If you found my help useful, please consider donating to Gallery.

 
digitaldonky
digitaldonky's picture

Joined: 2005-10-18
Posts: 59
Posted: Sun, 2010-11-28 23:15

Sadly I couldn't get it working. Which url I have to insert in the Options field?
My Picker for g3 is basically the same but I didn't manage the Insert yet.

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Sun, 2010-11-28 23:39

Base gallery3 URL, it'll make assumptions about the rest URL based on that. Could you post or PM me the URL to the gallery (along with an API key, if required) and I'll have a look? :-)

 
digitaldonky
digitaldonky's picture

Joined: 2005-10-18
Posts: 59
Posted: Mon, 2010-11-29 01:47

By the way. My gallery is in a subdirectory.

WP: wpg3.local
G3: wpg3.local/gallery3

Can it matter?

 
PseudoKnight

Joined: 2010-11-29
Posts: 2
Posted: Mon, 2010-11-29 05:34

I got a little excited until I realized it's just importing. Would it be easy for me to convert this to a "deep link" image insert? Is there a reason you avoided doing that in the first place?

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Mon, 2010-11-29 10:54
PseudoKnight wrote:
I got a little excited until I realized it's just importing. Would it be easy for me to convert this to a "deep link" image insert? Is there a reason you avoided doing that in the first place?

It'd be fairly easy, yes. The drawback is that you don't get the resize/positioning/caption/metadata controls from Wordpress for free and that you can't easily have G3 generate an image in a particular size.

If you're happy with a deeplink of the thumbnail, it wouldn't be too hard.

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Mon, 2010-11-29 19:28
digitaldonky wrote:
Sadly I couldn't get it working. Which url I have to insert in the Options field?
My Picker for g3 is basically the same but I didn't manage the Insert yet.

Try updating to plugin version 0.9.1. I added support for non-mod_rewrite installations (it was sort-of broken before) among other things. The base URL of the gallery install ought to work, it should be able to pick up the rest from there - or at least be more precise about what it doesn't like.

Be sure to visit the Settings pane and click Update options, though.

 
digitaldonky
digitaldonky's picture

Joined: 2005-10-18
Posts: 59
Posted: Tue, 2010-11-30 01:16

Works! Nice and fast :)

 
PseudoKnight

Joined: 2010-11-29
Posts: 2
Posted: Tue, 2010-11-30 07:32

Thanks. I think I'd rather have gallery handle all the data and not have a multiples of the same files everywhere. Positioning and captions could easily be handled by the picker by inserting the appropriate attributes. Though, one problem is if the photos were deleted from the gallery, they'd break the images in the blog. (hasn't been a problem yet) I'm going to have to think about this.

Do you have any future plans for this plugin?

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Tue, 2010-11-30 12:13

Yeah, I can understand that philosophy as well. Importing vs. Linking caters to different needs and I wouldn't mind doing both - but I needed to be able to scale the images, so importing was the only option for my particular use case.

Positioning and captioning controls independent of those of WP are sort-of coming - I need them for the Mediawiki sibling of the plugin anyhow, so that's happening. Would feel sort of bland to implement it without also doing resizing, so there's a slight chance that I'll look into an unlimited resize plugin for G3 to go along with that. The lack of that functionality disturbs me.

As for the WP plugin, yes, some future plans. For starters, I want to ensure that the current stuff is bug free, works for everyone and give it some more interface love - especially more progress indicators. After that, some really low-hanging fruit would be to look into image carousels, image-of-the-day and similar stuff implemented as WP widgets (Seeing that the REST API plumbing is already in place, it shouldn't be too tricky - once the resize thing works)

Will probably stop after that - more ambitious integrations are much better catered for by the philosophy of GWPG3 or heiv.

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Thu, 2010-12-02 20:25

Did an update. Highlights:

* Decent support for hidden albums.
* Deep linking, you can now choose between linking images from g3 or importing them into Wordpress.

 
shecter
shecter's picture

Joined: 2006-12-30
Posts: 130
Posted: Sun, 2010-12-05 19:20

Hi Kandsten,

I really like this module--thank you for working on it.

It seems to only work if I make my albums Viewable by "Everyone". I prefer to have my Gallery3 install locked so only registered users can view my pics. Is there any way to get your plugin to work in this situation?

Thanks,

Marc

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Sun, 2010-12-05 19:32
shecter wrote:
Hi Kandsten,

I really like this module--thank you for working on it.

Glad you like it :-)

shecter wrote:
It seems to only work if I make my albums Viewable by "Everyone". I prefer to have my Gallery3 install locked so only registered users can view my pics. Is there any way to get your plugin to work in this situation?

Yes, if you import the images into Wordpress, they can still be non-public in G3. If you use the latest version of the plugin, there's a nice big button saying Import, that should work out in your scenario. If you don't, then upgrade to the latest version - it has quite a bit more support for non-public albums.

 
shecter
shecter's picture

Joined: 2006-12-30
Posts: 130
Posted: Sun, 2010-12-05 19:56

Thanks for the response..i've got this version of the plugin: Version 0.9.3. is that the latest?

when i change the permissions for my album so that "Everyone" can't view them, my screen just sits here: http://screencast.com/t/leeSWOf6k2.

-Marc

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Sun, 2010-12-05 20:40

That's the latest, yes.

I have no idea right off the top of my head, but if you could PM me an API key and the URL to your Gallery, I'd be happy to have a look and sort whatever needs sorting in the plugin :)

 
shecter
shecter's picture

Joined: 2006-12-30
Posts: 130
Posted: Sun, 2010-12-05 21:41

Thanks Kandsten..i sent you a PM.

 
shecter
shecter's picture

Joined: 2006-12-30
Posts: 130
Posted: Tue, 2010-12-07 07:08

Hi Kandsten,

I organized my hierarchy as shown in this screen cap: http://screencast.com/t/gKZyi2JkPms. I still can't get this plugin to work.

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Tue, 2010-12-07 13:32

To summarize the private convo and the core issue: <gallery>/rest/item/1 throws a login page, which shouldn't happen. Since the setup was gallery-in-wordpress-win-wordpress, I suspected some odd mod_rewrite scenario, but this doesn't seem to have been the case. I don't have any totally bright ideas at this juncture.

 
shecter
shecter's picture

Joined: 2006-12-30
Posts: 130
Posted: Tue, 2010-12-07 18:03

hmmm... now that my hiearchy is setup better, i'll try reinstalling the gallery in my test directory.

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Wed, 2010-12-08 06:09

Trying this out on my WordPress (3.0.2) installation (your plug-in version 0.9.3.1) . I am able to select an image and everything; however, if I choose to not import the image into WP, the Insert into Post button does nothing. The import into WP works fine; however, I was under the impression that we didn't have to if we didn't want to.

Thanks,
Mark H.

Using Gallery 3.0+(git) - gallery.markheadrick.com

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Wed, 2010-12-08 10:44
MarkRH wrote:
however, if I choose to not import the image into WP, the Insert into Post button does nothing. The import into WP works fine; however, I was under the impression that we didn't have to if we didn't want to.

The plan is that it should be working, yes. What sort of nothing does it do, nothing at all, period - or the sort of nothing where it closes the media picker "window" but doesn't insert any HTML?

What browser are you using (specific version, if you may) and does the Javascript error console say anything during all of this?

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Wed, 2010-12-08 13:30

When I click the button, nothing happens. Window does not go away. No perceived action seems to take place. Here's an error from the Java Console:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: (*removed*)/gallery3-picker/gallery.js?ver=3.0.2 :: anonymous :: line 212"  data: no]

I am using Firefox 3.6.12 during this. WordPress 3.0.2 with a Twenty Ten Child Theme. If it matters, my test post had no text in yet, I was inserting an image first thing. I'll try with IE8 to see what happens.

Note: the (*removed*) part in the error was actually my blog's URL; however, it was trying to make it a clickable URL.. which it really should not do when inside of a BBC code block here.

OK, some thing with IE8. Clicking the Insert Into Page button does nothing and an error is generated with Javascript:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Wed, 8 Dec 2010 13:03:56 UTC


Message: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.
Line: 207
Char: 4
Code: 0
URI: (*removed*)/gallery3-picker/gallery.js?ver=3.0.2

After further troubleshooting, the error only occurs when I am using the Visual Editor Tab. If I switch to the HTML tab then insert an image, the process works fine and the HTML code is inserted into the post. This happens with both FF 3.6.12 and IE 8.0 (Version 8.0.6001.18702).

Thanks,
Mark H.

Using Gallery 3.0+(git) - gallery.markheadrick.com

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Wed, 2010-12-08 13:30

Right, that's the textbox insertion code so it makes sense. I'll see if I can replicate your setup and fix that (I run the same Firefox version and WP version when testing it in Firefox, so it should(tm) work by default, but I'll kick it in the chins a few times for good measure and see what happens).

Thanks for the heads-up.

Edit:
The IE8 message hints that it might be because it's trying to put text in a non-visible control, which would be the case when you're viewing your WP post in Visual mode. Does it work if you're viewing it in HTML mode before you try to insert the link?

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Wed, 2010-12-08 13:32

Edited post above before I saw your reply. Happening with Visual Editor Tab in both browsers. HTML tab is fine.

Thanks,
Mark H.

Using Gallery 3.0+(git) - gallery.markheadrick.com

 
shecter
shecter's picture

Joined: 2006-12-30
Posts: 130
Posted: Wed, 2010-12-08 17:36

I sort of spoke too soon.

In my last post, i found that my brand new clean test installs of WP and Gallery were working. However, my production WP and Gallery 3 installed were not working. I updated my production gallery to the current experimental release, and I'm able to correctly see [] at this link. However, the connection between my wordpress install and the gallery isn't happening. When I try to use Gallery Media Picker in Wordpress, the Gallery3 logs record this error:

2010-12-07 17:07:54 -08:00 --- error: Rest_Exception [ 404 ]: Not Found
/home/usr/public_html/gallery3-2/modules/rest/controllers/rest.php [ 115 ]
#0 [internal function]: Rest_Controller->__call('item', Array)
#1 /home/usr/public_html/gallery3-2/system/core/Kohana.php(331): ReflectionMethod->invokeArgs(Object(Rest_Controller), Array)
#2 /home/usr/public_html/gallery3-2/system/core/Event.php(208): Kohana_Core::instance(NULL)
#3 /home/usr/public_html/gallery3-2/application/Bootstrap.php(67): Event_Core::run(Array, Array)
#4 /home/usr/public_html/gallery3-2/index.php(97): require('/home/usr/pu...')
#5 {main}
2010-12-07 17:07:54 -08:00 --- error: Missing messages entry kohana/core.errors.404 for message kohana/core
2010-12-07 17:07:54 -08:00 --- error: Rest error details: Array
 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Wed, 2010-12-08 17:51

Visual tab stuff is fixed, 'twas just me doing it the hacky way rather than the proper way. Will push an update later today.

Shecter - that's looking rather odd. Was that v3.0.1? or 3.0 of G3? Details are appreciated :) Something fishy on the g3 side of things, by the look of it.

 
shecter
shecter's picture

Joined: 2006-12-30
Posts: 130
Posted: Wed, 2010-12-08 18:20

I am running the experimental release: gallery-gallery3-86790d4. My dashboard says: # Version: 3.0.x branch (git)

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Wed, 2010-12-08 20:20

Right. Can't reproduce locally, but the error message suggests that the plugin is asking for some item that G3 doesn't know anything about. Could you PM me an API key for the production gallery, and I'll have a look :-)

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Wed, 2010-12-08 22:00
kandsten wrote:
Visual tab stuff is fixed, 'twas just me doing it the hacky way rather than the proper way. Will push an update later today.

Awesome! looking forward to the update. Thanks for your work.

Thanks,
Mark H.

Using Gallery 3.0+(git) - gallery.markheadrick.com

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Thu, 2010-12-09 01:02

Updated.

Managed to find and nail shecter's issue as well, which is good.

On the slightly annoying side of things, the plugin has about as much code for working around the REST API requirements (and related HTTP related issues due to said requirements) as code actually doing something useful. As soon as there's a slightly more high performance means of fetching relevant data over the REST API, I'll add support for that. In the mean time, sorry if some operations are being slow in large galleries.

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Thu, 2010-12-09 04:45

Just wanted to say that the new version is working fine, including with the new version of WordPress, 3.0.3

Thanks!
Mark H.

Using Gallery 3.0+(git) - gallery.markheadrick.com

 
shecter
shecter's picture

Joined: 2006-12-30
Posts: 130
Posted: Thu, 2010-12-09 17:05

Your up dated version is working for me. Nice Job Kandsten.

 
scottnath

Joined: 2006-03-11
Posts: 54
Posted: Tue, 2010-12-14 17:23

Hi there,

I've installed the plugin in wordpress (3.02) but when I go to Add Post and click the "add image" or "add media" options (above the wysiwyg) there is no tab for gallery 3. That is the right place to look for it, correct?

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Tue, 2010-12-14 20:04
scottnath wrote:
Hi there,

I've installed the plugin in wordpress (3.02) but when I go to Add Post and click the "add image" or "add media" options (above the wysiwyg) there is no tab for gallery 3. That is the right place to look for it, correct?

Right place, yes. Did it say that the configuration was OK when you saved the config in the "Gallery3 media picker" config pane in the settings?

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Sat, 2010-12-18 02:45

New version released, with support for upcoming Gallery 3.0.1 features, namely rest/tree - this should make large galleries a lot nicer to work with.

scottnath: Could it be that your "Descriptive name" field is empty? If so, that would explain your problem. Added a check when saving the configuration to ensure that it can't happen.

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Sat, 2010-12-18 03:58

Thanks for the update.

Hmmm.. you know, you might try and see if you can get the "Post URL" button for the Link URL to match whatever the current Wordpress Permalink structure is instead of the post id URL. Just a thought.

Thanks,
Mark H.

Using Gallery 3.0+(git) - gallery.markheadrick.com

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Sat, 2010-12-18 14:26
MarkRH wrote:
Hmmm.. you know, you might try and see if you can get the "Post URL" button for the Link URL to match whatever the current Wordpress Permalink structure is instead of the post id URL. Just a thought.

It's actually using the get_permalink() function from Wordpress to get that, so it should(tm) be doing the right thing. What are you expecting and what are you getting? :)

 
swiftsam

Joined: 2009-09-23
Posts: 23
Posted: Sat, 2011-02-19 16:04

Are you still watching this thread kandsten? This plugin will save me huge amounts of time, but I can't get it working yet.

I added the REST API key, and it seems to be working ok. I get these messages on the config page:

Quote:
Configration OK, mod_rewrite support detected.
Detected REST tree support, will use this.

But when I try to insert a picture, it loads for a moment, then it just says "No pictures in this folder."

What can I do to troubleshoot this?

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Sat, 2011-02-19 19:01

Yup, still watching.

That problem sounds like fun. The easiest way to troubleshoot would be if you could setup an account for me on the G3 install and PM me the account information (The problem could be one of a number of things, I'm afraid - nothing that rings a bell at least)

 
creationsings

Joined: 2008-02-07
Posts: 57
Posted: Thu, 2011-03-03 20:04

I have the exact same problem as swiftsam. Has anything been discovered on that front?

 
swiftsam

Joined: 2009-09-23
Posts: 23
Posted: Thu, 2011-03-03 20:38

kandsten was nice enough to offer to take a look at my installation, and I was a dolt and haven't set that up yet. We are building an umbrella user authentication that isn't done so it's not easy for me to hook him up with login info. It's on my list, but I haven't gotten there yet. So no, no new information from me yet, but that's my fault not kandsten's. I'll make sure to post here if/when I get it solved.

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Fri, 2011-03-04 16:05

After setting up my gallery to be more SEO friendly by ending URLs with "/" by setting $config["url_suffix"] = "/"; in /application/config/config.php and tweaking my .htaccess file.. I broke the plug-in. Initially it showed nothing, not even the album tree.

I had to go in and modify your proxy.php and change all of your code that referred to gallery URLs:
For example, around line 170:

		//$root = $options['gallery3_url'] . 'rest/item/1';
		$root = $options['gallery3_url'] . 'rest/item/1/';

After doing this in several places, it displayed the album tree and I could select an image.

Anyway, you might experiment with different url_suffix values in the gallery config.php to see how it affects the plug-in (such as ".html"). You might even want to add an option in the settings screen to accommodate the possibility that someone has set this value in their gallery.

Oh, I am using WordPress 3.1 now.

Thanks,
Mark H.

Using Gallery 3.0.1 - gallery.markheadrick.com

 
creationsings

Joined: 2008-02-07
Posts: 57
Posted: Wed, 2011-03-09 18:03

This is driving me crazy. I wish I knew more about what I was doing. I don't really know anything about wordpress plugins. I do know, however, that when I use the modify headers firefox add on, I can successfully make rest calls to my gallery using my API key and get the json tree back. However, the wordpress plugin still just shows a blank screen. I haven't messed with the url_suffix, so without the "/" it works fine.

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Wed, 2011-03-09 18:31

Just a quick heads up to let you know I haven't abandoned this thing entirely. Will try to replicate the issues, hopefully tomorrow.

 
creationsings

Joined: 2008-02-07
Posts: 57
Posted: Thu, 2011-03-17 18:29

So, I just discovered that my web host had allow_url_fopen = Off in the php settings (I was tracking down another problem related only to gallery and not this wordpress plugin). I couldn't help but wonder: Could there be any other php.ini settings that are taken for granted that would be needed to make this code work properly? My host seems to be quirky in that manner and I've had to fix a few other things in the past because of slightly unexpected settings.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Thu, 2011-03-17 18:34
Quote:
Could there be any other php.ini settings that are taken for granted that would be needed to make this code work properly?

Probably. We can't possibly know how every odd-ball, screwy host is setup and mis-configured. It seems a lot of "hosts" don't realize they are providing a service for people to use. They are not a company with employees paying them to use their service, they are a company with customers paying them to use their service and some of these "hosts" lock their stuff down so much to prevent their customers from doing so much stuff....
____________________________________________
Like Gallery? Like the support? Donate now!

 
creationsings

Joined: 2008-02-07
Posts: 57
Posted: Thu, 2011-03-17 18:43

Any ideas where I should start looking? I'm relatively ignorant when it comes to php configuration -- when it works, it's a nice black box! :-) My host does allow me to create custom php.ini files, so if this were indeed the problem, there might be some chance I could fix it. I just don't know where to start! :-/

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Mon, 2011-03-21 16:20

Aside from what's listed here, no. Just fix problems as they arise. For a standard Debian (and probably Ubuntu) install, it just works :)
http://codex.gallery2.org/Gallery3:User_guide:Gallery3:Installing_and_upgrading#Before_you_start_.2F_System_requirements

____________________________________________
Like Gallery? Like the support? Donate now!

 
dpumphrey

Joined: 2011-04-18
Posts: 2
Posted: Mon, 2011-04-18 17:09

I really hope someone can assist me or help shed some light on my problem. I really think that WordPress and Gallery3 Picker is the exact solution I need for my vision, but I'm having trouble getting Gallery3 Picker to list images from my Gallery install when I go to post a new post in WordPress.

I have installed and activated the Gallery3 Picker plug-in for WordPress just fine. When I go to Settings->Gallery3 Media Picker, I have entered my Gallery3 URL as "www.danielpumphrey.com/gallery/". The plug-in has automatically filled in the Gallery3 REST API URL and I gave it a descriptive name of "Daniel Pumphrey Gallery". For the API Key I have tried leaving it blank, entering the API key for my admin user, my guest user and a wordpress user I created in my Gallery installation specifically for this plug-in to use.

However, when I go to Posts->Add New, select the "Add an Image" icon and then select "Daniel Pumphrey Gallery" the screen displays "Loading..." for a few seconds and then switches to "No Pictures in this folder".

I have used a web browser to hit what I believe is the REST API URL and I get back what looks like a successful REST API call return - http://www.danielpumphrey.com/gallery/index.php/rest/item/1

I have also made sure that guest and registered users have allowed access for both view and view full size for all albums.

I am using WordPress 3.1 and Gallery 3.0.1

Any ideas?

 
kandsten

Joined: 2010-11-26
Posts: 79
Posted: Mon, 2011-04-18 17:13

Ah, I found the problem. You need to enter http://www.danielpumphrey.com/gallery/ not www.danielpumphrey.com/gallery/ - if you do the latter, the detection code works, the rest doesn't. My bad, will add a check for that.

(The rest API URL btw should be http://www.danielpumphrey.com/gallery/index.php/rest/item/1 if you try stuff by hand :-) edit: but it seems you already figured that one)