Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » "Gallery" of Videos, Showing same image for all thumbs.

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 657 Views
  • house98
    Avatar
    Community Member
    31 Posts

    "Gallery" of Videos, Showing same image for all thumbs. Link to this post

    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!

  • house98
    Avatar
    Community Member
    31 Posts

    Re: "Gallery" of Videos, Showing same image for all thumbs. Link to this post

    *bumperdoodle*

  • house98
    Avatar
    Community Member
    31 Posts

    Re: "Gallery" of Videos, Showing same image for all thumbs. Link to this post

    *bumpskerific*

  • SerenityIT
    Avatar
    Community Member
    13 Posts

    Re: "Gallery" of Videos, Showing same image for all thumbs. Link to this post

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

    657 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.