Chosen thumbnail has to be bigger than requested one and not smaller
|Status:||Needs feedback||Start date:|
|Target version:||Candidate for next major release|
Currently thumbnail request with a size of 99 will provide an image of 50px.
Currently thumbnail request with a size of 149 will provide an image of 100px.
And one exception: thumbnail request with a size of 49 and less will provide an image of 100px.
Provided image has to be bigger then requested and not smaller, for example:
request from 1 to 50 -> 50px
from 51 to 100 -> 100px
from 101 to 150 -> 150px
small patch that makes this change is attached
#1 Updated by Stanislav German-Evtushenko almost 6 years ago
- from 0 to 49 -> 100px
- from 50 to 99 -> 50px
- from 100 to 149 -> 100px
- from 140 to 199 -> 150px
- 0 -> 100px
- from 1 to 50 -> 50px
- from 51 to 100 -> 100px
- from 101 to 150 -> 150px
from 151 to 200 -> 200px
#3 Updated by Jens Krämer about 1 month ago
Here's an alternative patch using Float#ceil. Also adds a corresponding test case.
#5 Updated by Go MAEDA about 1 month ago
- Status changed from New to Needs feedback
The following error occurred while running tests. Jens, could you check the patch?
Failure: AttachmentsControllerTest#test_thumbnail_should_round_size [/home/ubuntu/redmine-trunk/app/models/attachment.rb:222]: unexpected invocation: Redmine::Thumbnail.generate("/home/ubuntu/redmine-trunk/test/fixtures/files/2010/11/101123161450_testfile_1.png", "/home/ubuntu/redmine-trunk/tmp/thumbnails/16_8e0294de2441577c529f170b6fb8f638_300.thumb", 300) unsatisfied expectations: - expected exactly once, not yet invoked: Redmine::Thumbnail.generate() bin/rails test test/functional/attachments_controller_test.rb:409
This is my environment:
Environment: Redmine version 4.0.0.devel.17734 Ruby version 2.6.0-p-1 (2018-12-06) [x86_64-linux] Rails version 5.2.2 Environment development Database adapter SQLite Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp SCM: Subversion 1.9.3 Mercurial 3.7.3 Cvs 1.12.13 Bazaar 2.7.0 Git 2.7.4 Filesystem Redmine plugins: no plugin installed