RichFilemanager icon indicating copy to clipboard operation
RichFilemanager copied to clipboard

Thumbnail features

Open hhjung2013 opened this issue 7 years ago • 4 comments

In raising this issue, I confirm the following (please check boxes):

  • [x ] I have read and understood the Wiki. Especially deploy and configuration articles.
  • [ ] I have checked that the bug I am reporting can be replicated, or that the feature I am suggesting isn't already present.
  • [ ] I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion.
  • [ ] I realise that server-side connectors are provided by various contributors. The implementations are vary due to programming language features/limitations or other factors. Thus a particular connector may not implement, or partially implement, the API features.
  • [ ] I realise that any changes in configuration options and/or plugin parameters affect the plugin behavior. I specified all the differences from defaults in details.

I use the following server-side connector (check one):

  • [x ] PHP connector by servocoder
  • [ ] Java connector by fabriceci
  • [ ] Python3 Flask connector by jsooter
  • [ ] Python3 Flask connector by stevelittlefish
  • [ ] NodeJs connector by jlaustill and forestlake
  • [ ] ASP.NET Core connector by sinanbozkus
  • [ ] ASHX connector by richeflits
  • [ ] Other (specified below)

My familiarity with the project is as follows (check one):

  • [ ] I have never used the project.
  • [ x] I have used the project briefly.
  • [ ] I have used the project extensively, but have not contributed previously.
  • [ ] I am an active contributor to the project.

  1. Does RFM support the creation of additional thumbnails apart from the internal ones?

  2. Is there a way to let RFM create internal thumbnails subsequently for images that already exist in the content folder i.e. have not been not uploaded by RFM?

hhjung2013 avatar Jun 30 '18 23:06 hhjung2013

  1. RFM utilizes jQuery-File-Upload package by Blueimp with a number of modifications, but the thumbnail creation process remained almost original. This means you could refer to Wiki or Stackoverflow questions of the original package. In short you have to play with image_versions configuration option which is defined in the following files:

Extending the image_versions configuration option with new variants results in new image versions (thumbnails) being created. The way you are going to use new images is up to you completely.

  1. Once you open a folder with images, that were manually added, the RFM will create thumbnails automatically for you. In other words RFM creates a thumbnail for image if it's not exists yet.

psolom avatar Jul 01 '18 09:07 psolom

I'm not sure if this issue is related to JQuery-File-Upload or RFM, but when I add the code below to the constructor of Local/UploadHandler.php the extra image is created in the folder "small", however, its size is not 300 x 200 but 1280 x 960.

        // image small settings
        $this->options['image_versions']['small'] = array(
        		'max_width' => 300,
        		'max_height' => 200
        );

Any ideas why this is?

hhjung2013 avatar Jul 04 '18 18:07 hhjung2013

The solution to the above problem ist to put the settings for your extra small image before the thumbnail settings. For some reason it doesn't work if you put after the thumbnail settings.

        // original image settings
        $this->options['image_versions'] = array(
            '' => array(
                'auto_orient' => $this->storage->config('images.main.autoOrient'),
                'max_width' => $this->storage->config('images.main.maxWidth'),
                'max_height' => $this->storage->config('images.main.maxHeight'),
            ),
        );
        
        // image small settings
        if($this->storage->config('images.small.enabled') === true) {
        	$this->options['image_versions']['small'] = array(
        			'max_width' => $this->storage->config('images.small.maxWidth'),
        			'max_height' => $this->storage->config('images.small.maxHeight'),
        	);
        }
        
        // image thumbnail settings
        if($this->storage->config('images.thumbnail.enabled') === true) {
            $this->options['image_versions']['thumbnail'] = array(
                'upload_dir' => $this->model->thumbnail()->getAbsolutePath(),
                'crop' => $this->storage->config('images.thumbnail.crop'),
                'max_width' => $this->storage->config('images.thumbnail.maxWidth'),
                'max_height' => $this->storage->config('images.thumbnail.maxHeight'),
            );
        }

hhjung2013 avatar Jul 17 '18 20:07 hhjung2013

One more thing, is it possible to have RFM delete the additional small images on deletion of the original image just like it does with the internal thumbnails?

hhjung2013 avatar Jul 17 '18 20:07 hhjung2013