serendipity_event_galleryimage and gallery2?

Creating and modifying plugins.
Post Reply
JohnnyC
Regular
Posts: 10
Joined: Sun Oct 01, 2006 5:46 am

serendipity_event_galleryimage and gallery2?

Post by JohnnyC »

Here are the settings of the galleryimage plugin:

Which version of Gallery are you using? 2.x
URL of Gallery: http://www.mysite.com/g2
URL of the Gallery album directory: http://www.mysite.com/g2/v
Absolute gallery-path: /var/www/html/g2
Absolute album-path: /var/www/data
Maximum dimension for popup window: 640
Maximum dimension for thumbnailed pictures: 128
Entry Body: yes
Extended Body: yes
HTML Nugget: yes

Here's what I'm putting into my Serendipity blog post:

Code: Select all

[GImage caption=myImage; style=fancy; align=left;]fun/my_image.jpg.html[/GImage]
(also tried with just .jpg and no extension with the same result)
Here's the error message it's giving me:

Code: Select all

Fatal error: Call to a member function on a non-object in /var/www/html/serendipity/plugins/serendipity_event_galleryimage/serendipity_event_galleryimage.php on line 540
If I just go into Gallery2, this is what the url for the image looks like:
http://www.mysite.com/g2/v/fun/my_image.jpg.html
Last edited by JohnnyC on Sat Oct 07, 2006 2:34 am, edited 1 time in total.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: serendipity_event_galleryimage and gallery2 mod_rewrite?

Post by garvinhicking »

Hi!

In line 540 of the plugin, GalleryEmbed::init() is called. This seems to fail, as it does not return an object.

Are all paths correct, is the embed.php containing proper code from gallery?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
JohnnyC
Regular
Posts: 10
Joined: Sun Oct 01, 2006 5:46 am

Post by JohnnyC »

I found that if I changed:

Code: Select all

if ($ret->isError())
to:

Code: Select all

if (!empty($ret))
that I was able to get past this error. I did a search for this on the Gallery2 page, and apparently the isError() doesn't work in the new versions of Gallery2.

Also, one of these in the code:

Code: Select all

$image_path .= "&image=".$photo;
Has some funny character in the "&". It looks fine in UltraEdit, but when I was debugging in the browser, I noticed a funny character in there messing things up, so just replace the "&" on these lines with a fresh version.

My next error is that all I get back is an broken image, correctly sized. Lines like this look funny to me:

Code: Select all

$image_path = $serendipity['baseURL'] . ($serendipity['rewrite'] == "none" ? $serendipity['indexFile'] . "?/" : "/") . "plugin/g2wrapper?";
Because if rewrite is off, the url ends up with two question marks in it. Is this correct?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

What is inside the $ret variable in your case? In my editor, I see no strange characters in the line you mentioned...?

Could you tell us the URL where we can see the broken images you mention?

Are you using a recent version of Gallery2?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
JohnnyC
Regular
Posts: 10
Joined: Sun Oct 01, 2006 5:46 am

Post by JohnnyC »

Hello,
What is inside the $ret variable in your case?
I don't have the code here at work to quote from, so you'll have to bear with me :). My understanding of the initial connection to Gallery2 in this code is that it's just an initialization, and nothing would be returned by the $ret variable unless there's a problem.
In my editor, I see no strange characters in the line you mentioned...?
Well in that case, maybe something in my version became corrupted...
Could you tell us the URL where we can see the broken images you mention?
I figured out that it the way I was embedding Serendipity, my code was not using the information after the second question mark. After changing that, I was able to see the images.
Are you using a recent version of Gallery2?
Yes, if I run the update script in Gallery2, it tells me that everything is up to date.

I don't have a CVS program on my machine, so if you or someone else agrees with my changes, can that person update the code? :)

-jc
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I am just wondering, because the IF-statement you modified is there to emit error.

Your code will branch into that error-portion when $ret is not empty.

So that would be a problem: If $ret is an object (which was required in past versions!), it is not empty, and thus for all users where the plugin currently works, they would then get the error notices, because $ret is filled for those people.

Which is why I would really be interested in the content of your $ret :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
JohnnyC
Regular
Posts: 10
Joined: Sun Oct 01, 2006 5:46 am

Post by JohnnyC »

Ok, well how about:

Code: Select all

if (!empty($ret)) {
if ($ret->isError()) {
.
.
.
}
}
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

That's a good suggestion, I just committed something like this to CVS!

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply