Creating a view using the "Image Gallery: Latest Image" field generates numerous MySQL syntax errors -
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND n.type = 'image' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC LIM' at line 1 query: SELECT DISTINCT(n.nid) FROM node n INNER JOIN term_node tn ON n.nid = tn.nid WHERE tn.tid = AND n.type = 'image' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC LIMIT 0, 1 in /srv/www/htdocs/friends/sites/all/modules/image/contrib/image_gallery/views/image_gallery_handler_field_gallery_cover.inc on line 162.
Exported view:
$view = new view;
$view->name = 'Gallery';
$view->description = 'Gallery';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'image_gallery_latest_thumbnail' => array(
'label' => 'Latest image',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_taxonomy' => 0,
'depth' => '0',
'descendants' => 'single',
'image_derivative' => 'gallery_teaser',
'exclude' => 0,
'id' => 'image_gallery_latest_thumbnail',
'table' => 'term_data',
'field' => 'image_gallery_latest_thumbnail',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'name' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '%1 Gallery',
'breadcrumb' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'glossary' => 0,
'limit' => '0',
'case' => 'none',
'path_case' => 'none',
'transform_dash' => 0,
'add_table' => 0,
'require_value' => 0,
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_image_size' => '_original',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'image' => 0,
'panel' => 0,
'blog' => 0,
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'3' => 0,
'2' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'image_size' => array(
'_original' => '_original',
'thumbnail' => 'thumbnail',
'preview' => 'preview',
'gallery_teaser' => 'gallery_teaser',
),
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'perm',
'perm' => 'search content',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('use_pager', '1');
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'gallery');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
| Comment | File | Size | Author |
|---|---|---|---|
| snapshot45.png | 77.99 KB | badzilla |
Comments
Comment #1
joachim commentedThat's the wrong view, by the way.
You're in a term view. How can you not be getting a tid when you get to that point? Can you debug?
Comment #2
greta_drupal commentedI am getting the same error with a Node view. It is not passing the TID, as the above error message shows. The view, in my case a block, will display the rest of the fields fine, but no image.
What I've tried, alone and in combinations:
Added argument for Term ID
Added argument for Vocabulary ID
Added Taxonomy:Parent as argument instead
Added field Image:Image rather than ImageGallery:Latest
Added field Taxonomy ID "excluded from display"
Added taxonomy filter for vocabularly "image_galleries"
Clearing Views cache and site caches
No difference. Same error. Same missing TID.
Query:
Drupal 6.15
Image 6.x-1.0-beta4
Views 6.x-2.8
Other image modules installed:
---------------------------------
Image 6.x-1.0-beta4
ImageAPI 6.x-1.6
Imagetoolkit
Imagecache / Imagecache UI 6.x-2.0-beta10
CCK Imagefield 6.x-3.2
CCK Imagecrop 6.x-1.0-rc1
IMCE 6.x-1.3
Comment #3
joachim commented@greta_drupal: I don't see where there is a missing 'tid' in your query.
And more generally: you will need to to some debugging yourselves for these sorts of issues. If a handler is not getting the data it needs, you'll need to find out why.
Comment #4
greta_drupal commentedAND ( tn.tid IN () AND n.type = 'image' AND n.status = 1 )Are we sure there isn't a bug? I did not initiate this issue as "bug report", just noting my own experience likewise.
If you are not interested in addressing, guess I'll post in forum for troubleshooting assistance. As you can see, I have tried several things in troubleshooting.
Comment #5
joachim commented@greta_drupal: I don't see that in the query you posted. Granted, I'm still having breakfast, so feel free to highlight it for me! ;)
By debugging, I mean you will have to get into the code and get it to output debugging values to see why there is no tid at that point. And it's not that I am not interested, rather that I am maintaining this module in my free time and there is little of it. I can't spend hours digging into bugs like this that I won't be able to reproduce locally.
Comment #6
greta_drupal commentedSo, you have tried using Image Gallery:Latest successfully? Ruled out it being an error in the module code? (I saw a few user posts of this issue. None with any response/solution/troubleshooting.) I since have just scrapped use of that field, but it would be nice to know if/when it works.
Comment #7
joachim commentedIf you meant the Views field "Image gallery: Latest image", yes I have it in use on my test setup. Just fired it up and it is working perfectly.
If you see other issues for the same, exactly identical problem, then you could be of considerable help to me by marking them as duplicates. Or mark this as a duplicate, as the initial post on this one is completely wrong as I pointed out in a comment.
Lastly: have you tried clearing your Views cache???
Comment #8
greta_drupal commentedOf course...with my eyes closed, even.
Comment #9
joachim commented@greta_drupal: I still don't see where the missing tid is in your query.
Comment #10
joachim commentedOkay, I see the problem.
Sorry it's taken me so long; I either missed it when I looked at the screenshot in the original post, or didn't look at it (people tend to post screenshots of error messages, so I often don't look at them...)
The problem is that you've added the "Image gallery: Latest image" field on the NODE view.
You can't. It's just silly. It is a field for a gallery, as seen in a LIST OF GALLERIES -- ie the term view.
Comment #11
greta_drupal commentedWell, at least there is an alternative approach. For my purpose, I just wanted to create a better Latest Image than the one with Drupal. I had hoped that Image Gallery:Latest Image would make a distinction between images added to a gallery versus other images not associated with a gallery. I created a Photo-Of-The-Week block for front page and want only that block to show photos that had been added to galleries.
But, I just coded all those variables in a regular ol' block view with field image and taxonomy vocab/term filter, so no worries.
I'll add this to my "things about Views that might not work as you would expect" list.
Comment #12
joachim commented> I'll add this to my "things about Views that might not work as you would expect" list.
It is totally what you expect. It is a field of a term: the latest image for that term. If you have a view of terms, each row is a term, and your fields might be 'term name', 'term ID', 'term description', 'latest image'.
It makes no sense to put that on a node view: it's 'latest image' -- but latest image of what? How can a node have a latest image?
Lastly, please leave issue statuses as I put them unless you have a proper reason for changing them.
Comment #13
greta_drupal commentedYikes! Okay, for one thing, I closed this discussion that I picked up since you had provided a definite answer. I thought that was a best practice (and proper reasoning): close your tickets when answered. I apologize for trying to be helpful. (Other maintainers criticize users for not closing their issues. Whatever.)
But, since you are absolutely certain that the use of this field is crystal clear, I won't bother to argue the merits of your reasoning. I'll keep my perspective to myself.
Comment #14
joachim commentedFair enough about the closing; different projects have different habits. 'by design' is a valid closing-type status, as is 'wontfix'.
It's not clear in that it appears on node views and therefore incites users to think it might be a valid choice, but I don't think I can do anything about that -- other taxonomy term fields appear there too (and are just as invalid).