Image linking issue with Image Module
| Project: | PEAR Wiki Filter |
| Version: | 6.x-1.0-beta1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Hello,
Many thanks for the Pear Wiki Filter. It's been very useful and it is well worth the initial fiddling to install it and the MediaWiki syntax. I've run into a problem linking images, however. I'm using the Image Module and have that option selected on the filter configuration. When I attempt to attach an image using the [[Image:name.jpg]] syntax and preview the content, I get the following error message:
user warning: Unknown column 'f.nid' in 'on clause' query: SELECT n.nid, n.title, f.filename, f.filepath FROM node n LEFT JOIN files f ON n.nid = f.nid WHERE n.status = 1 AND n.type = 'image' AND LOWER(n.title) = LOWER('donkey.jpg') LIMIT 1 in /Applications/MAMP/htdocs/drupal-6.2/modules/pearwiki_filter/pear_override/render/Xhtml/Image.php on line 58.
Thanks for your help!

#1
Forgot to add this...
I checked and there is no nid in the files table, which is probably what is throwing the SQL error. I'm not a MySQL guru and I would love a suggestion on how the rewrite the query so it actually has something to compare as I don't see any fields that are shared by the two tables.
#2
I believe this was a change from 5.x -> 6.x that was overlooked during the upgrade.
#3
You can fix this problem by changing the query on line 58 (pear_override/render/Xhtml/Image.php) to the following:
SELECT n.nid, n.title, f.filename, f.filepath FROM {node} n LEFT JOIN {image} i ON n.nid = i.nid LEFT JOIN {files} f ON i.fid = f.fid WHERE n.status = 1 AND n.type = 'image' AND LOWER(n.title) = LOWER('%s') LIMIT 1
You will also need to change the line at 68 to this too because the arguments to the url function have changed.
$options['attr']['link'] = url("node/$image->nid", array('absolute' => true));
I haven't made this a patch because a) it's only two lines, b) I think that having the node table left joined to the image table would actually provide performance improvement, rather than left joining the image table to the node table. But this fixes the issues for now. That's for someone to benchmark with a site that actually has more content than mine.
#4
#5
this patch generated wrong href link for me
the generated code is
http://node/33
instead of
http://domain.com/node/33
#6
ok:
after a few checks I've installed the devel module and cleaned the cache.
From then it started working right.
#7
I seem to be having the same problem (links with http://node/1234), but I can't get it to work. I'm running with the patch as suggested above.
Is this Wiki filter dead btw? The suggestion to use another module isn't quite a viable option for me, since it doesn't provide all the functionality I need from these filters (I use a different Pear Wiki filter for starters, not mediawiki).
#8
Confirming this issue:
user warning: Unknown column 'f.nid' in 'on clause' query: SELECT n.nid, n.title, f.filename, f.filepath FROM node n LEFT JOIN files f ON n.nid = f.nid WHERE n.status = 1 AND n.type = 'image' AND LOWER(n.title) = LOWER('PK_087_farb_s') LIMIT 1 in /usr/local/www/drupal/sites/all/modules/pearwiki_filter/pear_override/render/Xhtml/Image.php on line 58.Exchanging those lines as explained above does not work very well for me; after saving a node with embedded-with-wiki-syntax-images, I'm getting a bunch of strange errors:
warning: Illegal offset type in isset or empty in ...drupal/modules/taxonomy/taxonomy.module on line 1011.warning: Illegal offset type in ...drupal/modules/taxonomy/taxonomy.module on line 1012.
warning: Illegal offset type in ...drupal/modules/taxonomy/taxonomy.module on line 1015.
warning: Illegal offset type in ...drupal/modules/taxonomy/taxonomy.module on line 591.
...
user warning: Duplicate entry 'digitalisierung-de' for key 2 query: UPDATE url_alias SET src = 'node/8', dst = 'digitalisierung', language = 'de' WHERE dst = 'imagedigitalisierung' in ...drupal/modules/path/path.module on line 108.
I don't know in which way these error messages are related to the PEAR Wiki Filter module, but they didn't show up before.
Edit: Additionally, it appears to be still impossible to link to image nodes with spaces in the title (which might not be so unusual); such links are rendered incorrectly with a mixture from pathalias and physical location, and without file extension. That's sompletely broken, as it seems.
I second zwoop's question from february 2009 in #7 and also would like to know if this module is abandoned; if so, it should be noted on the project page. Unmaintained modules like the PEAR Wiki Filter are absolute showstoppers for Drupal users.
Thanks to all helping out with patches!
Greetings, -asb