Giter VIP home page Giter VIP logo

yii2-filemanager's People

Contributors

alex-shcherbyna avatar chaimleich avatar deele avatar fabiomlferreira avatar gugoan avatar iliyanz avatar insane-dev avatar naffiq avatar patrick-yi-82 avatar pendalf89 avatar phamnhatcn06 avatar shah-typhoon avatar xiaomalover 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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-filemanager's Issues

Choose Language default

Hello. Hope you don't mind with some my issues.
I have updated my region language folder but I don't know how to setting this extension run with my region language. I'm looking forward from you soon. Thanks so much. (y)

URL --> id

Доброй ночи!

В файле Mediafilebehavior в строках 41 и 55 используется запрос медиа по url. Однако не всегда эти значения передаются по url. Иногда используется ID. Можно ли сделать возможность выбора id/url?

Multiple groups of thumbnail patterns

I don't want that every image that I upload creates all of those same thumbnail variants that are defined in configuration, I would like to see two-level thumbnail configuration options. For example, when user uploads his new avatar, I want it to create 3 thumbnails 50x50, 100x100 and 200x200, but when user uploads new article image, I want it to create 2 thumbnails, 150x50 and 300x100 - I don't want three more thumbnails for article images that will not be ever used.

To achieve that, configuration could be grouped:

'modules' => [
    'filemanager' => [
        'class' => 'pendalf89\filemanager\Module',
        // Upload routes
        'routes' => [
            // Base absolute path to web directory
            'baseUrl' => '',
            // Base web directory url
            'basePath' => '@frontend/web',
            // Path for uploaded files in web directory
            'uploadPath' => 'uploads',
        ],
        'default-thumbs' => 'default',
        // Thumbnails info
        'thumbs' => [
            'default' => [
                'small' => [
                    'name' => 'Мелкий',
                    'size' => [100, 100],
                ],
                'medium' => [
                    'name' => 'Средний',
                    'size' => [300, 200],
                ],
                'large' => [
                    'name' => 'Большой',
                    'size' => [500, 400],
                ],
            ],
            'user-avatar' => [
                'small' => [
                    'name' => 'Small',
                    'size' => [50, 50],
                ],
                'medium' => [
                    'name' => 'Medium',
                    'size' => [100, 100],
                ],
                'large' => [
                    'name' => 'Large',
                    'size' => [200, 200]
                ]
            ],
            'article-image' => [
                'intro' => [
                    'name' => 'Intro image',
                    'size' => [150, 50],
                ],
                'full' => [
                    'name' => 'Full image',
                    'size' => [300, 100]
                ]
            ]
        ]
    ]
]

To provide backwards compatibility with current version, checking of thumbs could be done to see if second level of first array element contains size key, if so, thumbs array is parsed in "no-groups" format, otherwise, it is parsed in "groups" format.

Thumbnail group should be provided as GET attribute during file manager module call through either URL or widget configuration.

In addition, for more flexibility and backwards compatibility for widget configurations without specific thumbnail group provided, default-thumbs attribute provides default thumbs group.

Having trouble getting this to work with jquery repeatable fields

When used within the repeatable fields the input/browse button is displayed and I can see the modal/iframe in my source.

On browse button click it just goes to home/base url.

I have the below code within my form:

<?php echo $form->field($model, 'publisher[{{row-count-placeholder}}][logo]')->widget(FileInput::className(), [
                            'id' => uniqid(),
                            'buttonTag' => 'button',
                            'buttonName' => 'Browse',
                            'buttonOptions' => ['class' => 'btn btn-default'],
                            'options' => ['class' => 'form-control'],
                            // Widget template
                            'template' => '<div class="input-group">{input}<span class="input-group-btn">{button}</span></div>',
                            // Optional, if set, only this image can be selected by user
                            'thumb' => 'original',
                            // Optional, if set, in container will be inserted selected image
                            'imageContainer' => '.img',
                            // Default to FileInput::DATA_URL. This data will be inserted in input field
                            'pasteData' => FileInput::DATA_URL,
                            // JavaScript function, which will be called before insert file data to input.
                            // Argument data contains file data.
                            // data example: [alt: "Ведьма с кошкой", description: "123", url: "/uploads/2014/12/vedma-100x100.jpeg", id: "45"]
                            'callbackBeforeInsert' => 'function(e, data) {
                                console.log( data );
                            }',
                        ]); ?>

Which outputs the follow html

<div class="form-group field-reviews-publisher-1-logo">
<label class="control-label" for="reviews-publisher-1-logo">Publisher</label>
<div class="input-group"><input type="text" id="reviews-publisher-1-logo" class="form-control"    name="Reviews[publisher][1][logo]"><span class="input-group-btn"><button id="reviews-publisher-1-logo-btn" class="btn btn-default" role="filemanager-launch">Browse</button></span></div>
 <div role="filemanager-modal" class="modal" tabindex="-1" data-frame-id="reviews-publisher-1-logo-frame" data-frame-src="/backend/index.php?r=filemanager%2Ffile%2Ffilemanager" data-btn-id="reviews-publisher-1-logo-btn" data-input-id="reviews-publisher-1-logo" data-image-container=".img" data-paste-data="url" data-thumb="original">
<div class="modal-dialog">
    <div class="modal-content">
            <div class="modal-body"></div>
        </div>
    </div>
</div>

<div class="help-block"></div>
</div>

How to config to upload a type of file to upload?

I'm using your extension to manager image of an object. But in default,I can upload all file type such as audio file MP3. But I only want to upload Image file as JPG, PNG , GIF...So can you help me to setting to upload only image file. Thanks a lot.

Implementing Rich features like moxiemanager

is it posible to implement such features like moxiemanager on this link! look at the following features
-The interface of the fie manager on clicking browse button
-Selection of multiple files
-Editing of images
-Multiple view options i.e List and thumbnails
-Ability to create folders
-Multiple upload options like from machine,google drive and Dropbox etc
-Search & sort functionalities

I am willing to support inclusion of this features let me know if anyone else is interested

Please revert the commit 3c220a0

Some months ago you accept to change the name from TinyMce to TinyMCE this broke my code and I think the code from others, now you change it again.

Please revert your last commit and keep the name of the file as TinyMCE.

Wrong URLs saved to database

I've noticed URL saved ignores the fact that the extension/module is not always on root of server.
My project is Subfolder of main projects folder and Instead of saving images URL in database url field as /projects/myproject/web/uploads/2015/06/wwwgfaorg2.jpeg it just puts /uploads/2015/06/wwwgfaorg2.jpeg

That would be fine if during Display it would concatenate with base URL aka @web but it dioes not hence I get blank page with not found responses on firebug.

Is there a config that I miss? Here is my config part

'modules' => [
        'filemanager' => [
            'class' => 'pendalf89\filemanager\Module',
            // Upload routes
            'routes' => [
                // Base absolute path to web directory
                'baseUrl' => '',
                // Base web directory url
                'basePath' => '@webroot',
                // Path for uploaded files in web directory
                'uploadPath' => 'uploads',
            ], 
        ],
    ],

1
2
3

how to use it?

Hello,
How can I use the owners after I am created or updated the post?
the owners table is empty and I can not use loadOneByOwner method.

Can you please explain me ?

Thanks

Upload from backend and view from frontend

Hi,

I really like the filemanager and tinymce integration, but unfortunately I can't get it to work in my setup (advanced template).
I'd like to use the filemanager and tinymce from backend to upload images and show the images in the frontend. I did the following configuration in the backend app:

'routes' => [
  'baseUrl' => '',
  'basePath' => '@frontend/web',
  'uploadPath' => 'uploads',
],

With this config the upload works fine to frontend but the images are not visible in the uploader. I can see in the JS-console, that the path is not correct:

uploads/2016/04/img0006-128x128.jpg

The right path would be:

frontend/web/uploads/2016/04/img0006-128x128.jpg

I know that "frontend/web" is not the right path in the live system, but I need this in my testing environment. Is it possible to configure the filemanager in a way, so that it can handle this path aswell?
I allready played around with the "baseUrl" but it seems that this has no influence to my issue.

So long

Sven

Configure thumbnails to either "fill" or "fit"

Currently, when Mediafile::createThumbs() creates thumbnails, it does not provide "mode" of image resizing, that leads to cropping image by default using ImageInterface::THUMBNAIL_OUTBOUND mode.

I would like to be able to provide within thumbnail configuration, which mode exactly to use.

Sorting and ordering of files, detailed view of files

When using file manager without ownership feature, after tens or hundreds of images has been uploaded, it is getting hard to use file manager view. When it is required to search and find images, when visual look on thumbnail is not enough, search by some additional parameters, like creation date, title, description etc is required.

This could be achieved either by adding just couple search boxes on top of file manager or even better - by creating switchable "Detail view". This could be done with GridVew widget, that provides parameters and filtering/ordering options.

hello!

can you give a demo? thank you !

Not working add owner

In MediafileBehavior.php replace:

private function loadModel($url)
    {
        return Mediafile::findByUrl($url);
    }

Package not found

Tried to install from composer but package not found error has occured.

Js Error

i use fileinput
in Firebug i got this, please help.

TypeError: modal.modal is not a function
modal.modal("show");
example.com/web/filemanager/file/filemanager" not found

Problem with routes.

Hello. Thank you for this great module!

I started to learn yii2 a few week ago. I never using this framework (yii1) never before. Excuse me if I writing something stupid..

In my project this module has one problem. With routes...
I use Yii2 advanced. I included this filemanager in backend. I tried to configured common/config/main.php:

'modules' => [
    'filemanager' => [
        'class' => 'pendalf89\filemanager\Module',
        // Upload routes
        'routes' => [
            // Base absolute path to web directory
            'baseUrl' => '',
            // Base web directory url
            'basePath' => '@frontend/web/images/',
            // Path for uploaded files in web directory
            'uploadPath' => 'uploads',
        ],
        // Thumbnails info
        'thumbs' => [
            'small' => [
                'name' => 'Small',
                'size' => [100, 100],
            ],
            'medium' => [
                'name' => 'Medium',
                'size' => [300, 200],
            ],
            'large' => [
                'name' => 'Big',
                'size' => [500, 400],
            ],
        ],
    ],
]

But images not showing. Image files - has writed to database, has uploaded to path which I configured - '/frontend/web/images/uploads/YYYY/MM'. And I have a field 'url' in database = '/uploads/2015/04/mestoraspolozhenie-xolodilnika.jpg' for example, but folder with my image is '/frontend/web/images/uploads/2015/04/mestoraspolozhenie-xolodilnika.jpg', so I added something to config in my backend/config/main.php:

'modules' => [
    'filemanager' => [
        'routes' => [
            'content_image_path' => '/frontend/web/images',
        ],
    ],
],

and I included this in two methods of models/Mediafile.php:

method №1: getDefaultThumbUrl
public function getDefaultThumbUrl($baseUrl = '')
{
// ....... code ......
// standart code:
// return "$dirname/$filename-{$width}x{$height}.$extension";
// my code:
return Yii::$app->getModule('filemanager')->routes['content_image_path']."$dirname/$filename-{$width}x{$height}.$extension";
}

method №2: getImagesList
public function getImagesList(Module $module)
{
// ....... code ......
foreach ($thumbs as $alias => $url) {
$preset = $module->thumbs[$alias];
// standart code:
// $list[$url] = $preset['name'] . ' ' . $preset['size'][0] . ' × ' . $preset['size'][1];
// my code:
$list[$module->routes['content_image_path'].$url] = $preset['name'] . ' ' . $preset['size'][0] . ' × ' . $preset['size'][1];
}

$originalImageSize = $this->getOriginalImageSize($module->routes);
// standart code:
// $list[$this->url] = Module::t('main', 'Original') . ' ' . $originalImageSize;
// my code:
$list[$module->routes['content_image_path'].$this->url] = Module::t('main', 'Original') . ' ' . $originalImageSize;
return $list;
}

After this manipulations the problem is gone. I hope so....

Excuse me, friend, if something wrong. It's my first Issue))).

Styling missing

Apologies about opening another issue however I seem to have none of the styling that is seen in your screen shots (i really want to get this installed as it is awesome).

I have installed it and uploads are working although I need to configure the path properly, however there's no styling.

github_filemanager_error

Any ideas?

z-index width Tiny MCE

Hello,

thank you for this great extensions.
I have a problem with it when I use it with TinyMCE (web version):

  • I click the button to add an image
  • TinyMCE The modal opens correctly, I click on the icon "source" to open the file manager of the modal
  • The modal opens the file manager but behind that of Tiny MCE

Result: impossible to select an image.

I looked in the code a solution, but for now, I have found nothing.

How can I fix this?

Thank you in advance for your reply.

Arnaud

Composer cannot find package

Hi your file manager looks awesome, I was just trying to install in via composer and get the following message:

- The requested package pendalf89/yii2-filemanager could not be found in any version, there may be a typo in the package name.

Any ideas?

Can you add a setting for thumbnail URL? or is my route config wrong?

I have the following route setup in my backend config:

        'routes' => [
            // Base absolute path to web directory
            'baseUrl' => '',
            // Base web directory url
            'basePath' => '@frontend',
            // Path for uploaded files in web directory
            'uploadPath' => 'uploads',
        ],

The files are uploaded to the correct directory however once uploaded the following message is displayed:

{"files":[{"url":"/uploads/2015/12/test.jpg","thumbnailUrl":"/backend/uploads/2015/12/test-128x128.jpg","name":"test.jpg","type":"image/jpeg","size":9713,"deleteUrl":"/backend/filemanager/file/delete?id=2","deleteType":"POST"}]}

As you can see the thumbnail URL has backend at the beginning which isn't necessary.

Disable file title and description

I would like to see an option to disable file title and description for situations when similar fields are provided elsewhere, it is confusing users thus creating worse user experience.

Mediafile::getThumbs() should return an array even if unserialize() returned null

Consider the following two pieces of code:

public function getThumbs()
{
    return unserialize($this->thumbs);
}

and

public function deleteThumbs(array $routes)
{
    $basePath = Yii::getAlias($routes['basePath']);

    foreach ($this->getThumbs() as $thumbUrl) {
        unlink("$basePath/$thumbUrl");
    }

    unlink("$basePath/{$this->getDefaultThumbUrl()}");
}

I encountered a situation where the thumbnails weren't stored properly (max process time issue - not important :)), which caused deleteThumbs to break because the foreach() was being run on a null value.

My suggestion: to make the code more bullet-proof, either modify getThumbs as follows:

public function getThumbs()
{
    return unserialize($this->thumbs) ?: [];
}

or modify deleteThumbs() to cast the result of getThumbs as an array:

public function deleteThumbs(array $routes)
{
    $basePath = Yii::getAlias($routes['basePath']);

    foreach ((array)$this->getThumbs() as $thumbUrl) {
        unlink("$basePath/$thumbUrl");
    }

    unlink("$basePath/{$this->getDefaultThumbUrl()}");
}

Directory, grouping or tagging capability

Currently, this file manager supports single level view of files, without any way to structure or organize files. I would like either some sort of similar multi-level directory structure capability or single level grouping option. It would be even better, if user could add some tags to files and see some sort of clickable tag list at the bottom of file manager and do quick filtering of files. Creation of tags could be achieved in the same view as title and description is currently, just that auto-complete option would be really nice.

Render File Manager

Hi, is there a way to only render the File Manager into a view as per the 4th screenshot. What am i missing here?

How to changes the function to create thumnail?

Hello.
I'm using yii2-filemanager you're created. It's very helpful. But I have a problem:
The default mode when create thumbnail images is THUMBNAIL_OUTBOUND. But I want to change it to THUMBNAIL_INSET. I'm looking for a config but It didn't have a config about it. Hope you to help me! Thanks a lot.

Having problems with cyrillic file names

Hi!
When images have been uploaded to the folder, they have following names:
1aaad59771

Then images are not available in the file manager:
v29jgebip57vag

It would be great if there were possibility to upload files with cyrillic names, or had the opportunity to enable automatic file renaming, not only this:
ba04geqcpe0oay

Btw, thanx for the module 👍
And sorry for my english.

[IMPORTANT] Please revert the commit bb487f766d352b1975d113f192e8a5befaa4f6e1

This commit change the view/file/filemanager.php and add this

if(file_exists(substr($model->getDefaultThumbUrl($this->params['moduleBundle']->baseUrl), 1))){
                    return Html::a(
                        Html::img(Yii::getAlias('@web').$model->getDefaultThumbUrl($this->params['moduleBundle']->baseUrl))
                        . '<span class="checked glyphicon glyphicon-check"></span>',
                        '#mediafile',
                        ['data-key' => $key]
                    );
                }
                else{
                    return null;
                }

This code simply break the module in my website now I can't visualize the images in advanced template.
I don't understand exactly the code but this don't work so must be reverted to the previous one.

Better file upload

Currently, file upload is very tedious, requires many, seemingly useless clicks to upload and confirm and return etc.

To upgrade user experience, I would like to suggest couple improvements:

  • File upload section should be redesigned so that it is more like overlay over file manager box, than "another page" which is confusing users.
  • Process of upload should take less clicks - when files are uploaded, user should be taken back to file manager view automatically.
  • Selection and loading icons should be chosen less intrusive, they are too big and gives less formal look of module.

Not working when using within backend

Hi,

I have the file manager working within my frontend however when using the file input within the backend and selecting an image within the file manager I get the following error message in my console:

GET http://localhost:8888/backend/filemanager/file/info?id=89&strictThumb=original 500 (Internal Server Error)

I am also unable to upload images from the backend as I get the following message:

{"files":[{"url":null,"thumbnailUrl":"/backend/assets/b2588d8f/images/file.png","name":null,"type":null,"size":187011,"deleteUrl":"/backend/filemanager/file/delete","deleteType":"POST"}]}

Разные директории для сохранения файлов?

Здравствуйте!
Этот менеджер создает папки для файлов вида "2014/12", но я хотел бы самостоятельно управлять этим путем. Например на конкретной странице мне нужно что бы путь был "post/1" или "product/23".
То есть я хочу раскладывать файлы не по датам, а по смыслу.
Как это сделать?

TinyMCE widget filename case problem

День добрый,
У меня возникла такая ситуация:
Я разрабатывал один сайт на локальной машине (Windows 8.1) и после того как выкатил его на сайт, то возникла ошибка: на бою система не нашла класс для TinyMCE виджета. Тогда я заметил, что в папке /vendor/pendalf89/yii2-filemanager/widgets/ файл называется TinyMce

Есть ли причина оставлять этот файл с таким именем?

Mysql primary key is too long

Hello. I can't apply this migration on my production server:

https://github.com/PendalF89/yii2-filemanager/blob/master/migrations/m141203_173402_create_filemanager_owners_table.php

MySQL version:

~$ mysql --version
mysql  Ver 14.14 Distrib 5.5.36-34.0, for debian-linux-gnu (x86_64) using  EditLine wrapper

Error I got when tried to apply migraion:

*** applying m141203_173402_create_filemanager_owners_table

create table filemanager_owners ...
Exception 'yii\db\Exception' with message 'SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

The SQL being executed was: CREATE TABLE `filemanager_owners` (
    `mediafile_id` int(11) NOT NULL,
    `owner_id` int(11) NOT NULL,
    `owner` varchar(255) NOT NULL,
    `owner_attribute` varchar(255) NOT NULL,
    PRIMARY KEY (`mediafile_id`, `owner_id`, `owner`, `owner_attribute`)
)'

What I can do? I can't change server because it's my client's server.

Security issue

First, I want to thank you and suggest an update.
Filemagener can be access by url without login.
I updated FileController function behaviors like this:

public function behaviors() { return [ 'access' => [ 'class' => \yii\filters\AccessControl::className(), 'only' => ['index', 'filemanager', 'uploadmanager', 'upload', 'update', 'delete','resize','info'], 'rules' => [ [ 'actions' => ['index', 'filemanager', 'uploadmanager', 'upload', 'update', 'delete','resize','info'], 'allow' => true, 'roles' => ['@'], ], ], ], 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ 'delete' => ['post'], 'update' => ['post'], ], ], ]; }

owners

Не добавляются и не сохраняются овнеры .
Метод всегда будет возращать false

mediafile behavior :
/**
* Load model by id
* @param int $id
* @return Mediafile
*/
private function loadModel($id)
{
return Mediafile::findOne($id);
}

Это так задумано или ч.я.д.н.т ?

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.