Closed (fixed)
Project:
Node Gallery
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
18 Nov 2009 at 12:53 UTC
Updated:
8 Jan 2010 at 10:18 UTC
Jump to comment: Most recent file
Hi Maintainers,
I found a little bug in the node_gallery.pages.inc. On an empty gallery I got an php warning invalid arg.. for each for line 290 and 370 on the tabs manage images / sort images tab.
The functions are: node_gallery_edit_images_form and node_gallery_sort_images_form
both functions have an foreach statement that will run without checking if there is an image. So just wrapp it with an if statement.
//but fid is just an identifier here, so needn't care it.
// only do this if there is an image
if (!empty($gallery->images) && is_array($gallery->images)) {
foreach ($gallery->images as $fid => $f) {
$options[$fid] = '';
if ($f->is_cover) {
$cover_fid = $fid;
}
}
}
And the warning will not show up on empty galleries.
Cheers
Dirk
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | node_gallery.pages_.inc_.patch | 1.11 KB | dbeall |
| #3 | node_gallery.pages_.inc_.patch | 1.11 KB | dbeall |
| #1 | node_gallery.pages_.inc_.patch | 630 bytes | dbeall |
Comments
Comment #1
dbeall commentedYep, sure is a bug and this sure did fix it.. Nice Find Dirk !!
Made a patch file from Design Work's code..
Comment #2
dbeall commentedhold on a second.. that is just one function.. brb
Comment #3
dbeall commentedduu, here it is with both functions and it actually had 3 errors..
manage images / sort images tab and Galleries list page
Comment #4
dbeall commenteddarn.. the + sign was in the wrong place on the second function.. I'm done now..
Thank you Dirk, I have a few other things I don't know how to fix if you want to use your skills..
-- the image caption display in lightbox2 contrib #481420: Image caption not appearing below image in lightbox view This is marked fixed, but it's really half fixed...
I don't know php yet, just started attempting to learn it..
Comment #5
designwork commentedHi dbeall,
yes I will see what I can do to help. I`m trying to integrate some different display options for galleries first. than I have a look at the lightbox problem.
Just one question about the usability.
I have a gallery list, from there i go to a gallery with Thumbnails, from there i go to the image to see it bigger. For me this are to much steps. I expect at the gallery level allready a kind of sildeshow.
Do you think I`m wrong?
Dirk
Comment #6
designwork commentedHi dbeall,
you may have a look here to see what I mean http://photographer.freelens.ws/node/7
Cheers
Dirk
Comment #7
designwork commentedHi dbeall,
I think I found a solution wich is more convinient for the lightbox problem.
As I remember lightbox uses the alt text of the images to display as caption.
So in your function (theme.inc)
you call twice the $image->title as attribute for theme imagecache. Instead of this you should use it like this
I had the same problem with my js that I use to display the gallery on the link I gave you.
Cheers
Dirk
Comment #8
kmontyGreat catch. Thanks for the patch DesignWork (and dbeall!)
Comment #10
natmchugh commentedThe best solution I found to this problem is to decalre the return array in function node_gallery_get_gallery_images before use
i.e. add $images = array(); to the top of the function