9. Command Line Tools

9.1. Media commands

9.1.1. Synchronize thumbnails

Synchronize thumbnails for the provider sonata.media.provider.image in the default context.

Note

There is also an interactive shell for parameters.

bin/console sonata:media:sync-thumbnails sonata.media.provider.image default

9.1.2. Remove thumbnails

Remove thumbnails for the provider sonata.media.provider.image in the default context and small format.

Note

There is also an interactive shell for parameters.

bin/console sonata:media:remove-thumbnails sonata.media.provider.image default small

9.1.3. Update metadata

Update metadata for a set of media for the provider sonata.media.provider.youtube with the default context.

Note

There is also an interactive shell for parameters.

bin/console sonata:media:refresh-metadata sonata.media.provider.youtube default

9.1.4. Add a media

Add a media to the provider sonata.media.provider.image with the default context from path.

bin/console sonata:media:add sonata.media.provider.image default path/to/image.jpg

Add youtube media from url.

bin/console sonata:media:add sonata.media.provider.youtube default http://www.youtube.com/watch?v=BDYAbAtaDzA&feature=g-all-esi&context=asdasdas

Add dailymotion video from provider reference.

bin/console sonata:media:add sonata.media.provider.dailymotion default BDYAbAtaDzA

Add image from given path with additional attributes.

bin/console sonata:media:add sonata.media.provider.image default path/to/media.png --description="foo bar" --copyright="Sonata Project" --author="Thomas" --enabled=false

9.1.5. Mass import

Add multiple media files from csv file

bin/console sonata:media:add-multiple --file=medias.csv

Add multiple media files from stdin

cat medias.csv | bin/console sonata:media:add-multiple

The medias.csv file contains the following lines:

providerName,context,binaryContent
sonata.media.provider.dailymotion,default,http://www.dailymotion.com/video/xuvt7q_cauet-et-psy-au-trocadero-video-officielle-c-cauet-sur-nrj_music
sonata.media.provider.dailymotion,default,http://www.dailymotion.com/video/xsbwie_psy-gangnam-style_music
sonata.media.provider.dailymotion,default,http://www.dailymotion.com/video/xqziut_tutoriel-video-symfony-2-twig_lifestyle
sonata.media.provider.dailymotion,default,http://www.dailymotion.com/video/x9bgxs_php-tv-4-magento-mysql-symfony-zend_tech
sonata.media.provider.dailymotion,default,http://www.dailymotion.com/video/xhq4c5_slyblog-tutoriel-video-symfony-1-4-partie-2-2_tech

9.1.6. Fix missing root categories

Creates default root categories for the SonataClassificationBundle if they don’t exist. This command should be executed when creating a new context under the contexts config tree.

bin/console sonata:media:fix-media-context

9.1.7. Update CDN status

Updates and keeps synchronized the media with the CDN flush status for a given provider (IE: sonata.media.provider.image) in the given context (IE: default).

Note

There is also an interactive shell for arguments.

bin/console sonata:media:update-cdn-status sonata.media.provider.image default