Giter Site home page Giter Site logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 19, 2024
Hi Chris,

Thank you for reporting this issue.

The behavior you've described is definitely not deliberate, and works contrary 
to what would be reasonably expected.

This issue seems to occur when the file extension for the output file is in 
lowercase letters. (e.g. JPG, Jpg, etc)

I'll have to take a closer look into what kind of use cases exhibits this 
issue, and then I'll address the issue and release a new version of 
Thumbnailator.

I can't make any promises about when I can fix the problem, but if not this 
weekend, I should be able to by the end of this month.

Once again, thank you for taking the time to write a detailed report on this 
issue.

Chris

Original comment by [email protected] on 10 Aug 2011 at 3:55

  • Changed state: Accepted

from thumbnailator.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 19, 2024
Hi, thanks for the quick response, look forward to the next release but no
time pressure from my end.

Original comment by [email protected] on 10 Aug 2011 at 7:05

from thumbnailator.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 19, 2024
This issue has been addressed in Thumbnailator 0.3.9.

-----

This defect was causing extraneous file extensions to be appended to the end of 
thumbnail filenames when the file extension of the specified destination was 
not in lowercase.

For example, the following code did not cause an extraneous file extension to 
be added, as the destination file name specifies the extension with lowercase 
letters:

  Thumbnails.of("path/to/image.jpg")
    .size(100, 100)
    .toFile("path/to/thumbnail.jpg");
  // -> The thumbnail is written to "path/to/thumbnail.jpg"

The following, however, will have an extraneous "jpg" appended to the end of 
the file name, as the file extension of the destination is a uppercase "JPG":

  Thumbnails.of("path/to/image.jpg")
    .size(100, 100)
    .toFile("path/to/thumbnail.JPG");
  // -> The thumbnail is written to "path/to/thumbnail.JPG.jpg"

Furthermore, specifying the output format via the `outputFormat` method could 
have lead to even stranger behavior when the format was not specified in 
lowercase:

  Thumbnails.of("path/to/image.jpg")
    .size(100, 100)
    .outputFormat("JPG")
    .toFile("path/to/thumbnail.JPG");
  // -> The thumbnail is written to "path/to/thumbnail.JPG.JPG"

These were serious violations of the principle of least surprise, and 
furthermore, extremely difficult to work around.

-----

Now, the destination file name is considered "correct", so unless there is a 
incorrect (extension not suitable for the format specified in the 
`outputFormat` method) or missing extension in which case the default file 
extension will be appended to the file name.

Please refer to the following examples to see how Thumbnailator 0.3.9 handles 
file extensions:

  Thumbnails.of("path/to/image.jpg")
    .size(100, 100)
    .toFile("path/to/thumbnail.JPEG");
  // -> The thumbnail is written to "path/to/thumbnail.JPEG"

  Thumbnails.of("path/to/image.jpg")
    .size(100, 100)
    .outputFormat("jpg")
    .toFile("path/to/thumbnail.JPEG");
  // -> The thumbnail is written to "path/to/thumbnail.JPEG"

  Thumbnails.of("path/to/image.jpg")
    .size(100, 100)
    .outputFormat("JPEG")
    .toFile("path/to/thumbnail.jpg");
  // -> The thumbnail is written to "path/to/thumbnail.jpg"

Original comment by [email protected] on 13 Aug 2011 at 12:21

  • Changed state: Fixed

from thumbnailator.

Nithyananadakamath avatar Nithyananadakamath commented on May 19, 2024

Wanted to know If we can store the files by converting the filenames to uppercase using thumbnailator. Please let me know if we have any option to do so.. Thanks

from thumbnailator.

Related Issues (20)

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.