GithubHelp home page GithubHelp logo

Comments (8)

aq1018 avatar aq1018 commented on July 25, 2024

Made a commit here:

243a682

Basically forcing storage and retrieval of style names to string.

Can you check and see if this fixes your issues?

from paperclip-dimension.

aq1018 avatar aq1018 commented on July 25, 2024

ooops... closed by accident...

from paperclip-dimension.

johnnyshields avatar johnnyshields commented on July 25, 2024

Sorry for the delay in getting back to you on this. This fix seems to work, I guess you should probably update the readme that self.image_dimensions['large'] should always be accessed with a string.

from paperclip-dimension.

aq1018 avatar aq1018 commented on July 25, 2024

Hmmm... wasn't expecting people are using this directly. This seems like an abstraction leak. Maybe I should create a wrapper method like self.image_dimensions_for :large? @johnnyshields, any comments?

from paperclip-dimension.

johnnyshields avatar johnnyshields commented on July 25, 2024

In your readme you state:

  1. It's fair game to access to p.image_dimensions directly
# retrieve image dimensions for all sytles
p.image_dimensions
#   {
#     'original' => [2048, 1024],
#     'large'    => [350, 175],
#     'medium'   => [150, 75],
#     'small'    => [30, 15]
#   }
  1. You already gave a wrapper method p.image_dimension(:size)
# get image dimension as an array
p.image_dimension               # [2048, 1024]
p.image_dimension(:original)    # [2048, 1024]
p.image_dimension(:large)       # [350, 175]

I think I'd just change the wording in the readme so that p.image_dimension(:size) is listed first and is the recommended way to access, and p.image_dimensions should only be used if the user requires the full hash of dimensions. In the case of p.image_dimensions, please also make a note that the keys will be strings, not symbols.

from paperclip-dimension.

johnnyshields avatar johnnyshields commented on July 25, 2024

Just one more thought, I think part of my confusion is a quirk in English language where I'd say the image's "dimensions" (plural) are 150x350, so calling 150x350 a "dimension" (singular) sounds slightly awkward. Given how accustomed us rubyists are with readability of code, for some reason image_dimensions[:large] looked prettier to me than image_dimension(:large). Perhaps renaming/aliasing image_dimension(:large) to image_dimensions_for(:large) is slightly more legible.

from paperclip-dimension.

aq1018 avatar aq1018 commented on July 25, 2024

Yeah, English isn't my strongest language... LOL

Anyways, I'm ok with image_dimensions_for(:large) or image_size(:large). Can you send a PR? It should be pretty straight forward to change.

from paperclip-dimension.

johnnyshields avatar johnnyshields commented on July 25, 2024

OK will add it to my todo-list. A bit tied up with my app's launch at the moment.

from paperclip-dimension.

Related Issues (5)

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.