Image path wrong in xsfp_playlist_node.module

crystaldawn - February 11, 2009 - 10:04
Project:XSPF Playlist
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Description

When putting thumbs into a playlist, the path is created incorrectly. It uses a relative path and does not append the base_path() to the path it receives. This will cause images to not show up on anything that is not in the document root. The fix is simple.

On line 370 change:

<?php
'value' => $thumb,
?>

To

<?php
'value' => base_path().$thumb,
?>

Now when you view /node/1/xspf from a player that is located at something like /node/somewhere, the images will actually show up rather than be blank.

#1

riyana56 - September 6, 2009 - 23:22

Please post which code to change in the 6.x version please.

#2

riyana56 - September 7, 2009 - 00:54
Version:5.x-1.20-beta1» 6.x-1.x-dev

I have found the solution for this in 6.x.

In xspf_playlist\xspf_playlist_thumb\xspf_playlist_thumb.module go to line 162.

Change it from

      if (strstr($file->filemime, 'image')) {
        $thumbs[] = $file->filepath;
      }

to

      if (strstr($file->filemime, 'image')) {
        $thumbs[] = '/'. $file->filepath;
      }

In my scenario, merely adding the slash was enough to make the images no longer break.

 
 

Drupal is a registered trademark of Dries Buytaert.