Inside the thumbnail selector when editing a node, the module is showing thumbnails of CCK images correctly, but images embedded in a WYSYIWYG editor with relative paths are broken inside the image tag. I am using the WYSIWYG module and TinyMCE in this case. This is caused by the relative path with a leading slash being passed to the url() function in opengraph_meta.module:
// if we have images in this node then show thumbnail selector
$image_paths = OpenGraphMeta::instance()->harvest_images_from_node($node);
if (!empty($image_paths)) {
$image_selector_options = array();
foreach ($image_paths as $path) {
$abs_path = url($path);
$image_selector_options[$path] = "<img src=\"$abs_path\" alt=\"$path\" title=\"$path\" width=\"32px\" height=\"32px\" />";
}
I've changed $abs_path = url($path); to $abs_path = url(ltrim($path,'/')); to trim off the leading slash so that a valid system path is always being passed to url().
I also added some useful classes to the thumbnail image form and on each image. This allows the thumbnails to be styled more easily (to float left, for instance), if there are a lot of images available for a node. This was needed since '#options' => $image_selector_options, writes the full image path as an id on each image wrapper.
Patched against 6.x-1.x-dev (2011-May-03).
| Comment | File | Size | Author |
|---|---|---|---|
| opengraph_meta_ltrim.patch | 1.23 KB | vinmassaro |
Comments
Comment #1
hiddentao commentedFixed in dev.
Comment #2
hiddentao commentedThanks for the patch.
Comment #3
hiddentao commentedNeed to patch 7.x-1.x-dev.
Comment #4
hiddentao commentedPatched in 7.x now too.
Comment #5.0
(not verified) commentedAdded clarity