sonata-media-bundle

How to correctly delete all images uploaded using sonata-media-bundle

筅森魡賤 提交于 2019-12-11 10:04:44
问题 I have uploaded some images using the sonata-media-bundle, as suggested here $media = new Media; $media->setBinaryContent($file->getRealPath()); $media->setContext('myContext'); $media->setProviderName('sonata.media.provider.image'); $mediaManager->save($media); Previous code creates the media correctly all files (according to context config) and db registry. Now what I did to delete the media is calling like this: $media = $mediaManager->findOneBy(array('id' => $id)); $mediaManager->delete(

Sonata Admin ManyToOne error: “sonata_type_collection - mapping : 2 ”

流过昼夜 提交于 2019-12-10 10:57:04
问题 I want to use Sonata Admin Gallery feature into my News Entity . Here is my code News.yml .... manyToOne: gallery: targetEntity: Application\Sonata\MediaBundle\Entity\Gallery inversedBy: news_gallery cascade: ["persist"] nullable: true Gallery.orm.xml .... <one-to-many field="news_gallery" target-entity="Wenweipo\NewsBundle\Entity\News" mapped-by="gallery" /> NewsAdmin.php protected function configureFormFields(FormMapper $formMapper) { $formMapper ->add('gallery', 'sonata_type_collection',

How to get Sonata Media Bundle to generate pictures in separate folders

﹥>﹥吖頭↗ 提交于 2019-12-10 10:56:33
问题 I'm struggling with a problem that I need Sonata Media Bundle to upload pictures to different folders. What I'm trying to reach is to generate a picture structure as the following: if the picture has an ID for 1234567 the original image will be put into folder: "/web/uploads/1234/567/original' And all the generated thumbnails/sizes will be like: "/web/uploads/1234/567/100x130" and "/web/uploads/1234/567/200x100" depending on the generated size. Is this folder structure generation possible in

Sonata Admin ManyToOne error: “sonata_type_collection - mapping : 2 ”

不羁的心 提交于 2019-12-06 04:41:13
I want to use Sonata Admin Gallery feature into my News Entity . Here is my code News.yml .... manyToOne: gallery: targetEntity: Application\Sonata\MediaBundle\Entity\Gallery inversedBy: news_gallery cascade: ["persist"] nullable: true Gallery.orm.xml .... <one-to-many field="news_gallery" target-entity="Wenweipo\NewsBundle\Entity\News" mapped-by="gallery" /> NewsAdmin.php protected function configureFormFields(FormMapper $formMapper) { $formMapper ->add('gallery', 'sonata_type_collection', array( 'cascade_validation' => true, ), array( 'edit' => 'inline', 'inline' => 'table', 'sortable' =>

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

落爺英雄遲暮 提交于 2019-12-03 20:13:23
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: http://%s3_bucket_name%.s3-website-%s3_region%.amazonaws.com providers: image: filesystem: sonata.media.filesystem.s3 file: resizer: false allowed_extensions: ['pdf'] allowed_mime_types: ['application/pdf', 'application/x-pdf'] filesystem: s3: bucket: %s3_bucket_name% accessKey: %s3_access_key% secretKey: %s3_secret_key% region: %s3_region% I added the following parameters to my parameters.yml: s3

Symfony Sonata Media Bundle add images/videos to a user

本秂侑毒 提交于 2019-12-03 13:18:40
问题 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 images field and a videos field to my User Entity ? (both plural) Regards, nova 回答1: Media is the Entity that saves all the properties of your video / picture : width / height / file path... The Entity Gallery is useful if you want to link multiple

Handling multiple file uploads in Sonata Admin Bundle

隐身守侯 提交于 2019-11-26 18:22:48
问题 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 each company can have multiple files: PDF, DOC, XLS and some other mime/types. I think to use VichUploaderBundle but again docs only covers example for one to one relationship so my question is, any can give me some examples or ways to get this