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).

CommentFileSizeAuthor
opengraph_meta_ltrim.patch1.23 KBvinmassaro

Comments

hiddentao’s picture

Fixed in dev.

hiddentao’s picture

Status: Active » Fixed

Thanks for the patch.

hiddentao’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Fixed » Patch (to be ported)

Need to patch 7.x-1.x-dev.

hiddentao’s picture

Status: Patch (to be ported) » Fixed

Patched in 7.x now too.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Added clarity