Media module allowed-types. Inserting new types



  • Hey there.
    While continuing enjoying using asgard found some things.
    For example, if i set 'allowed-types' => '.jpg,.png, .svg,.doc',
    And then uploading some files, svg or doc to website, it uploads perfectly, but unable to insert those type files in page using standart interface. And even unable to see what is the path of uploaded files, to insert them manually.
    Wish u best of luck on developing your project.
    Thank you for your jobe.


  • Global Moderator

    That is because Media module tries to return media thumbnail path to your interface for image type.
    Actually media is in the database and you can access them using data from your post controller.

    Something like:

        use Modules\Blog\Repositories\PostRepository;
        use Modules\Media\Repositories\FileRepository;
    
        private $post;
        private $file;
    
        public function __construct(PostRepository $post, FileRepository $file)
        {
            parent::__construct();
    
            $this->post= $post;
    
            $this->file = $file;
        }
        public function index()
        {
            $post = $this->post->find(1);
            $findFile = $this->file->findFileByZoneForEntity('thumbnail', $post);
            dd($findFile->getAttributes());
        }
    

    Indeed Media module should rework this part where it expects types of images only.



  • Looks like I'm running older version of asgard, cause unable to see such model as blog in Models folder.
    Anyway, i got the point, so will be heading to do as you advising.
    Thank you so much.


  • Global Moderator

    @dnk588
    Blog module is optional asgard module that you can install on top of platform

    Sorry about that, you can use same thing in Page module, just replace use Modules\Blog\Repositories\PostRepository; with use Modules\Page\Repositories\PageRepository; and pass PageRepository in constructor instead of PostRepository and rename variables as you would like.


  • Global Moderator

    Looks like there's small bug in some methods of media module.



  • Glad that my feedback helped somehow


Log in to reply
 

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.