Giter VIP home page Giter VIP logo

easy-media-bundle's People

Contributors

arnaud-ritti avatar dependabot[bot] avatar jdadeliom avatar jeandaviddaviet avatar jeromeengeln avatar lucasvigneron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

easy-media-bundle's Issues

Not view theme in EasyAdmin 4 and Symfony 6

I can't show theme of media manager and i don't know what doing wrong. I have followed the instrucctions up to section Manage medias in your Easyadmin dashboard. Attach screenshot of show media index.

easyMediaScreen

Thanks for your time.

Multiselect

Is possible to make EasyMediaField multiselect or atleast can i combine somehow EasyMediaField with CollectionField?

btw. thank you alot for great bundle.

greeting Kristijan

Expose MediaManager's createFrom* methods and/or allow entity modifications before save

There's no point in having a customizable Media entity when the createMedia method creates the entity and then immediately persist is and flushes the DB (which, by the way, is a terrible practice as it can cause unexpected flushes in the middle of a request).

For one it'd be nice if all the createFrom* methods were public for more granular control by user.

The save issue could be solved in several ways:

  • Remove the save method from createMedia since it's the programmer's responsibility to manage entities. You don't necessarily want to always immediately persist (and definitely not flush) an entity you create. This is easiest and IMO most correct but breaks BC.
  • Pass an argument to createMedia on whether to save; perhaps just $flush like you have on other methods. This is a simple solution even if it's not very neat.
  • Add some events to the manager logic that fire right after entity creation, right before save, etc. This would add great verstility, is still correct, and allows most customization (especially if you add events for other things too). It's however somewhat harder, though I'd suggest doing this anyway in addition to one of the above options.

EasyMediaManager error after updating

Hello ! Thans a lot for fixing some issues in the latest updates.

I am now getting this error after updating to latest version (2.0.31) :
Adeliom\EasyMediaBundle\Service\EasyMediaManager::__construct(): Argument #1 ($filesystem) must be of type League\Flysystem\FilesystemOperator, League\Flysystem\Local\LocalFilesystemAdapter given

The child config "media_entity" under "easy_media" must be configured.

`Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! In ArrayNode.php line 226:
!!
!! The child config "media_entity" under "easy_media" must be configured.
!!
!!
!! 2021-11-10T09:05:21+01:00 [info] User Deprecated: Method "Symfony\Component\HttpKernel\Bundle\Bundle::getContainerExtension()" might add "?ExtensionInterface" as a native return type declaration in the future. Do the same in child class "Adeliom\EasyCommonBundle\EasyCommonBundle" now to avoid errors or add an explicit @return annotation to suppress this message.
!! 2021-11-10T09:05:21+01:00 [info] User Deprecated: Method "Symfony\Component\HttpKernel\Bundle\Bundle::getContainerExtension()" might add "?ExtensionInterface" as a native return type declaration in the future. Do the same in child class "Adeliom\EasyMediaBundle\EasyMediaBundle" now to avoid errors or add an explicit @return annotation to suppress this message.
!!
Script @auto-scripts was called via post-update-cmd

Installation failed, reverting ./composer.json and ./composer.lock to their original content.`

What can be done?

Media Manager not working when folder has been deleted

When I go to a folder, his folderId is stored inside localStorage. It is used then to access the same folder when opening the media library.
But if I delete the folder, the folderId may still be inside the localStorage.
The bundle should check if the doesn't exist then it should load the root of the media library, cause as of today it prevent to do anything.

media-library-error

Manager - createFolder > setParent should be called before getPath is used

I think I found a quite impactful logic error in method createFolder from EasyMediaManager.

Folder::getPath is used before setParent has been called, therefore, if the folder should be nested, the path returned (and then created by the filesystem) is wrong (relative to root instead of parent folder).

Here is the code of the function, I've added comments to explain my point :

public function createFolder(?string $name, ?string $path = null): ?Folder
    {
        if ('.' === $path) {
            $path = '';
        }

        $class = $this->getHelper()->getFolderClassName();
        /** @var Folder $entity */
        $entity = new $class();

        if ($name) {
            $entity->setName($name);
        }

        $folder = $this->folderByPath($path);
        if (false === $folder && !empty($path)) {
            $folder = $this->createFolder(basename($path), dirname($path));
        }

        if (!empty($this->getHelper()->getFolderRepository()->findBy(['parent' => $folder, 'name' => $name]))) {
            throw new FolderAlreadyExist($this->translator->trans('error.already_exists', [], 'EasyMediaBundle'));
        }

        // in the next two lines, getPath only returns slug of $entity since it has no parent yet
        if (!$this->filesystem->directoryExists($entity->getPath())) {
            $this->filesystem->createDirectory($entity->getPath(), []);
        }

        $entity->setParent($folder ?: null); // This should be called before
        $this->save($entity);

        return $entity;
    }

This error leads to multiple issue with "File/folder already exists", I would be happy to open a PR if needed.

Probably related to #25

Error in fileIsType method

In src/Service/EasyMediaHelper, there is this condition inside fileIsType method.

if ((($type && str_contains((string) $type, 'image')) || in_array($type, $mimes['image'] ?? [])) && 'image' !== $compare) {
    return true;
}

This will return true if we compare, for example image/jpeg with video.
I think this is not expected and I'd be glad to open a PR in order to fix this but I don't really understand what this condition should be.

Maybe you can help me here @arnaud-ritti ?

BadRequestException when using fosckeditor integration with symfony 6.x

When using fosckeditor integration with symfony 6.x, the 'restrict' config cause a BadRequestException when the value is an array.

Symfony\Component\HttpFoundation\Exception\BadRequestException:
Input value "restrict" contains a non-scalar value.

The $request->query->get('restrict') doesn't accept array type as it was deprecated in 5.x and removed in 6.0.
$request->query->all('restrict') should be used instead.

See : symfony/symfony#41766 (comment)

No icons for Download + Upload from URL

There are no icons displayed in views :

  • upload from URL in partials/manager/dropzone.html.twig;
  • download file in parials/card.html.twig

The button close in modals aren't visible as well - class modal-close :before + :after could have a background-color to display the "X"

Adeliom\EasyMediaBundle\Service\EasyMediaManager::__construct(): Argument #1 ($filesystem) must be of type League\Flysystem\FilesystemOperator, League\Flysystem\Local\LocalFilesystemAdapter given, called in /var/www/html/francois-rouan/var/cache/dev/ContainerKp7v7sX/getEasyMedia_ManagerService.php on line 34

After installation of this package, I have the following error during symfony cache:clear and anywhere in front

Adeliom\EasyMediaBundle\Service\EasyMediaManager::__construct(): Argument #1 ($filesystem) must be of type League\Flysystem\FilesystemOperator, League\Flysystem\Local\LocalFilesystemAdapter given, called in /var/www/html/francois-rouan/var/cache/dev/ContainerKp7v7sX/getEasyMedia_ManagerService.php on line 34

My config is :
PHP 8.2
Apache2
Symfony 6.4 LTS

Exception in MediaSubscriber

When moving a media from the manager, an exception is occuring in this Subscriber :

Typed property Adeliom\EasyMediaBundle\EventListener\MediaSubscriber::$manager must not be accessed before initialization

The property $manager is defined, but never initialized, the injected service in the constructor is not used :

class MediaSubscriber implements EventSubscriberInterface
{
    protected \Adeliom\EasyMediaBundle\Service\EasyMediaManager $manager;

    public function __construct(EasyMediaManager $manager)
    {
    }
    // ...
}

Having two folder with the same name create issue when reusing the media

When creating a media, a folder is created.
If I want to create another media with another folder, I can't, because each folder slug must be unique.

Example :

pages/home/media1.jpg
home/media2.jpg

It will create a conflict as media2jpg will have a folder named home-2 for no conflict, but then the path is different from the slug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.