Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

"Gallery" of Videos, Showing same image for all thumbs.


Reply

4 Posts   688 Views

Avatar
house98

16 April 2011 at 7:45am Community Member, 31 Posts

Hey there.

Not sure how or why this is happening, but for a gallery-style page of videos using the VideoPopup method (tested with others, $Player, etc), the thumbnails are the same. Viewing the source of output page shows that they reference the same .jpg for the thumb.

Here's what information I 'think' you need:

Running latest DataObjectManager (Build Date: 2011-04-01)

VideoPage.php:

class VideoPage extends Page
{
static $has_many = array (
'Videos' => 'Video'
);

public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Videos", new FileDataObjectManager(
$this,
'Videos',
'Video',
'Video',
array('Title' => 'Title', 'Description' => 'Description'),
new FieldSet(
new TextField('Title'),
new TextareaField('Description')
)
));
return $fields;
}
}

class VideoPage_Controller extends Page_Controller
{

}

Video.php:

class Video extends DataObject
{
static $db = array (
'Title' => 'Varchar(100)',
'Description' => 'Text'
);

static $has_one = array (
// Make sure this comes first
'VideoPage' => 'VideoPage',
'Video' => 'FLV'
);

}

templates/Content/VideoPage.ss:

<% control Videos %>

<div class="resource" style="padding: 0 6px 0 25px; width:200px;">
<% control Video %>
<p>$VideoPopup(260x152,854x480)</p>
<% end_control %>
<div class="description">
<strong>$Title</strong>
<p>$Description</p>
</div>

</div>
<% end_control %>

In this case the Titles are different, the Descriptions are different and once clicked, the video that plays is different (all good and expected) -- just the thumbnail is the same across the board.

The kicker: In assets/video_thumbnails/ all the files are created properly, however the images on the parsed page are pointing to the _resampled directory, and pulling the same-named file, in this case 'croppedimage260152-.jpg' ...

It appears that the re-sampling process is truncating the file-names to the same name, so the last video file I upload gets turned into the thumbnail that they all end up using.

Bug? File-naming issues?

Any thoughts on the matter would be great.

Thanks!

Avatar
house98

19 April 2011 at 5:17am Community Member, 31 Posts

*bumperdoodle* :)

Avatar
house98

20 April 2011 at 2:16am Community Member, 31 Posts

*bumpskerific*

:)

Avatar
SerenityIT

11 May 2011 at 12:04am Community Member, 13 Posts

Gallery doesn't even work for me. Just causes an Error 500 on the server.