Hi all,

Default thumbnail doesn't appear. Path is wrong in output HTML.

My Drupal home page is something like : http://www.mydomain.com/drupal
My Emfield Video configuration : "Default thumbnail path" = files/video_thumbnail.png

.htaccess :
RewriteBase /drupal

settings.php :
$base_url = 'http://www.mydomain.com/drupal';

In output HTML thumbnail should be
http://www.mydomain.com/drupal/files/video_thumbnail.png
but it is
http://www.mydomain.com/drupal//drupal/files/video_thumbnail.png

I should miss something, but what ?

Thx for your help

Comments

srobert72’s picture

This issue looks like another one in "site_map" module.
Could you check if it is a bug or not ?

In this comment commiter explain his fix :
http://drupal.org/node/545762#comment-1951108

Nick Robillard’s picture

Status: Needs review » Active

I'm getting this too.

Here's the problem in the generated markup:

<a rel="lightframe[video|width:441; height:366;]" class="thickbox lightbox-processed" title="See video" href="/emvideo/thickbox/133/425/350/field_video_url/brightcove3/35640064001"><img width="106" height="106" title="See video" alt="See video" src="//sites/sitename/files/Image_3_1.png"/></a>

Specifically, src="//sites/sitename/files/Image_3_1.png"

It's like base_path() is getting prepended twice (when i remove one of the / with Firebug, it works). My path in Emfield Video configuration is relative, just like srobert72's - sites/sitename/files/Image_3_1.png - no leading /.

Something else that is misleading is the path example in the Default thumbnail path field description:
Path to a local default thumbnail image for cases when a thumbnail can't be found. For example, you might have a default thumbnail at files/thumbnail.png.

Judging by the path that is output, that example should say sites/sitename/files/thumbnail.png instead of files/thumbnail.png

The default thumbnail functionality needs some work. (changing to bug report)

Nick Robillard’s picture

Status: Needs review » Active

I've dug into the code and base_path() is being added to the path before it goes through theme_image() - which handles relative paths.

Current
Starting at line 87 of emvideo.theme.inc:

// If we still don't have a thumbnail, then apply a default thumbnail, if it exists.
  if (empty($thumbnail_url)) {
    $default_thumbnail_url = $field['widget']['thumbnail_default_path'] ? $field['widget']['thumbnail_default_path'] : variable_get('emvideo_default_thumbnail_path', NULL);
    if ($default_thumbnail_url) {
      $thumbnail_url = base_path() . $default_thumbnail_url;
    }
  }

Removing base_path() fixes this.

Fixed
Line 91

...
      $thumbnail_url = $default_thumbnail_url;
...
Nick Robillard’s picture

Category: support » bug
Status: Active » Needs review

Also, it'd be nice to see line 341 of emvideo.module updated so that the description text is not misleading.

Currently
$description = t("Path to a local default thumbnail image for cases when a thumbnail can't be found. For example, you might have a default thumbnail at %files.", array('%files' => 'files/thumbnail.png'));

Proposed
$description = t("Path to a local default thumbnail image for cases when a thumbnail can't be found. For example, you might have a default thumbnail at %files.", array('%files' => 'sites/sitename/files/thumbnail.png'));

(updating status to Needs Review)

Nick Robillard’s picture

Status: Active » Needs review
StatusFileSize
new572 bytes

Here is a patch that applies the fix from #3.

(patched against 6.x-1.x-dev from 2009-Aug-27)

srobert72’s picture

Status: Active » Needs review

Patch from #5 that applies the fix from #3 works correctly for me.
It resolves my issue.

Now thumbnail is correctly looked for in this path :
http://www.mydomain.com/drupal/files/video_thumbnail.png

And my Emfield settings are :
Default thumbnail path :
files/video_thumbnail.png

So fix proposed in #4 isn't necessary in my case.

I would be great if maintainer could include this patch in 6.x-1.x-dev release.

Nick Robillard’s picture

Right. In your case it isn't.

The reason is because theme_image() passes the path through url().

In url(), we have this:

if (!isset($options['base_url'])) {
  // The base_url might be rewritten from the language rewrite in domain mode.
  $options['base_url'] = $base_url;
}

I still propose the change in #4 though, because on 90% of Drupal setups, the "files" dir is under "sites" and a custom $base_url isn't defined as you have done. So I'm thinking the sites/sitename/files/thumbnail.png path suggestion would still be more accurate for most situations.

srobert72’s picture

New release 6.x-1-x-dev (2009-Sept-02) doesn't include patch in #5

Is it possible to maintainer to commit it for next DEV release ?

aaron’s picture

Status: Needs review » Fixed

this has been fixed now. thanks for the help!

Status: Fixed » Closed (fixed)

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