Comments (8)
Made a commit here:
Basically forcing storage and retrieval of style names to string.
Can you check and see if this fixes your issues?
from paperclip-dimension.
ooops... closed by accident...
from paperclip-dimension.
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.
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.
In your readme you state:
- 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]
# }
- 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.
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.
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paperclip-dimension.