Questions tagged [sonata-media-bundle]

SonataMediaBundle is a main bundle of Sonata admin which handles all media providers like youtube,vimeo,dailymotion,files(all file types) and provides a structure to build custom media provider.The SonataMediaBundle is a media library based on a dedicated provider which handles different type of media: files, videos or images.

Each sonata media type is managed by a provider service which is in charge of:

  • retrieving media metadata
  • generating media thumbnail
  • tweaking the edit form
  • rendering the media

Each media can be linked to a context. A context can be news, user or any name you want. A context allows you to group a set of pictures together. As requirements can be different for each context, a context is defined by a set of formats and a set of providers.

As the infrastructure is not standard, the MediaBundle abstracts the filesystem layer and the cdn layer. Visit : https://sonata-project.org/bundles/media/3-x/doc/index.html for full documentation

195 questions
7
votes
2 answers

Symfony Sonata Media Bundle add images/videos to a user

I am trying to integrate Sonata Media Bundle in my project. The problem is, that i don't understand how the bundle works. It has generated a Media, Gallery and GalleryHasMedia class within 'Application'. What are they for? How can I now add an…
nova.cp
  • 455
  • 1
  • 9
  • 22
6
votes
3 answers

save sonata media path into twig variable

I want to store full path of image (sonata media bundle) into variable in twig. Is that possible? If I write: {% set pic = path item.image, 'big' %} it throws me an error: Unexpected token "name" of value "item" ("end of statement block" expected)…
repincln
  • 2,029
  • 5
  • 24
  • 34
6
votes
1 answer

The filter "number_format_decimal" does not exist in SonataMediaBundle:MediaAdmin:edit.html.twig at line 54

SonataMediaBundle used to work correctly. Since I installed and configured SonataPageBundle it doesn't work anymore .. At first, I had a 500 Internal Server Error as a response (I created the default site, the default pages and the default…
6
votes
2 answers

SonataMediaBundle: Files/Images not found

I'm using SonataMediaBundle with SonataAdminBundle and Symfony 2.3. When I try to upload an image via the Sonata Admin interface: Click on "Add New" (app_dev.php/admin/sonata/media/media/create) Click on "Image"…
Blacksad
  • 1,230
  • 1
  • 14
  • 23
6
votes
1 answer

Handling multiple file uploads in Sonata Admin Bundle

So, after research a lot and get no results (maybe I'm a bad searcher) I coming from this topics: SonataAdmin Bundle File Upload Error and SonataMediaBundle - how to upload images? I can't find a solution for my problem. I have a Entity Company and…
Reynier
  • 2,420
  • 11
  • 51
  • 91
6
votes
3 answers

Symfony2 Sonata Media Bundle Custom Image Cropping

It seems that Sonata Media has only two strategies when it comes to cropping/resizing the uploaded image, Sonata\MediaBundle\Resizer\SimpleResizer and Sonata\MediaBundle\Resizer\SquareResizer. Both these strategies are automatic, meaning that the…
Aman Varshney
  • 820
  • 1
  • 9
  • 26
5
votes
1 answer

Prevent direct access to uploaded files only for unauthorized users - Symfony

I am trying to give direct access to uploaded files only for logged in users in my website for security concerns. I tried this configuration but it seems to be working on download image. This is my Twig file code where I am showing the image. {%…
Owais Aslam
  • 1,577
  • 1
  • 17
  • 39
5
votes
4 answers

Sonata Media Bundle missing entity Category

I try to install the Sonata Media Bundle into the Symfony CMF following this guide: https://sonata-project.org/bundles/media/3-x/doc/reference/installation.html. This command php app/console sonata:easy-extends:generate --dest=src…
Frank B
  • 3,667
  • 1
  • 16
  • 22
5
votes
1 answer

SonataMediaBundle - S3 AWS: 'The configured bucket "my-bucket" does not exist

I'm trying to configure the AWS s3 filesystem on my Sonata-Project, but I always get the following error: The configured bucket "my-bucket" does not exist. My sonata_media.yml: cdn: server: path:…
Spomsoree
  • 123
  • 1
  • 8
5
votes
1 answer

How to get image path in twig using SonataMediaBundle?

I'm using SonataMediaBundle to keep track of my images. I can render the image in twig using Sonata's helper: {% media user.profilepic, 'reference' %} This will render into an But, what I want to obtain is the naked path, so I…
George Irimiciuc
  • 4,573
  • 8
  • 44
  • 88
5
votes
2 answers

Upload to AmazonS3 with SonataMediaBundle

I'm wondering how to wrap aws php sdk (aws/aws-sdk-php) within Symfony2 in order to use as cdn with SonataMediaBundle. My current sonata confuguration: sonata_media: default_context: default db_driver: doctrine_orm contexts: …
peter
  • 147
  • 2
  • 13
5
votes
1 answer

SonataMediaBundle: How to add svg file extension

I need to add .svg file extension to my configuration. At the moment in my project I have other extensions as (pdf, images) I made the following changes Added a new svg_file to the context Added the file provider (In the end of configuration…
Reyela
  • 146
  • 1
  • 8
5
votes
1 answer

Sonata media gallery

I try to make a web site with Symfony. So I installed SonataAdminBundle and SonataMediaBundle. And I have a question about Sonata media. I created a gallery with a lots of image media in it and I don't know how I can access it from my…
4
votes
0 answers

Sonata Media - file extension validation in admin

I just want to validate the extension of image that I upload in Sonata Admin (v3.28.0) with Sonata Media Bundle (v3.10.0) in Symfony (v2.8.32) application. I've read all similar questions and Sonata documentations, but still don't have a success. I…
Pavel Alazankin
  • 1,325
  • 1
  • 12
  • 22
4
votes
0 answers

Sonata Media Bundle delete image programmatically

It seems that there is no documentation about how to delete images programmatically with Sonata Media Bundle. I found another post saying that you need to call delete on the media manager. Here is my mapping: /** * @var…
StockBreak
  • 2,857
  • 1
  • 35
  • 61
1
2 3
12 13