Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow scaling only height #11

Open
josgerrits opened this issue Mar 4, 2020 · 9 comments
Open

Allow scaling only height #11

josgerrits opened this issue Mar 4, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@josgerrits
Copy link

Hi,

We want to automatically scale the image only by height. At the moment this is not allowed since you'll get an error when you only set a "h" in the ci-sizes option.

Is this an easy change? Or do we have to work around this for now?

@dzmitry-stramavus
Copy link
Member

dzmitry-stramavus commented Apr 2, 2020

hey @josgerrits

We are polishing a new version of the plugin in which it'll be allowed to do.

@dzmitry-stramavus dzmitry-stramavus added the enhancement New feature or request label Apr 2, 2020
@josgerrits
Copy link
Author

josgerrits commented May 11, 2020

@dzmitry-stramavus I noticed you have released a new version 13 days ago. I still don't see a way to do what i want to achieve. My goal is to have a div with a height of let's say: 400px and full screen width. I want my image to keep it's original aspect ratio and simply take up the height of the div.

I can see you have an option ci-sizes and in the docs you have an example "'(min-width: 620px)': { h: 560 },". But when i use that, i still get the error "w is undefined". I'm using the latest version "4.5.0".

@dzmitry-stramavus
Copy link
Member

hey @josgerrits ,

hm, can you do a quick codesandbox snippet of the problem?

Looks working in demo page https://scaleflex.github.io/js-cloudimage-responsive/

image

@josgerrits
Copy link
Author

@dzmitry-stramavus ah my bad, i was using 3.5 instead of 4.5.. I still can't seem to achieve what i want though. Can u explain how i would make the image take up the height of the parent? Here's my sandbox example: https://codesandbox.io/s/js-cloudimage-responsive-example-g3cli?file=/index.html

@josgerrits
Copy link
Author

josgerrits commented May 11, 2020

I figured it out, the demo page says: operation="crop". This does not work for me, but when i use ci-params="func=crop" it does. I think that's what i'm looking for.

@dzmitry-stramavus
Copy link
Member

dzmitry-stramavus commented May 11, 2020

@josgerrits ,

currently, you can do the following thing

<div style="width: 200px; height: 400px;">
  <img ci-src="alain.jpg" ci-params="func=crop&gravity=auto" />
</div>

image

here is updated codesandbox: https://codesandbox.io/s/js-cloudimage-responsive-example-iugg2?file=/index.html

also, I'm doing one more approach to use height detect option. I'm not sure when I have time to finish it though (1-2 weeks probably)

hope it helps

@josgerrits
Copy link
Author

josgerrits commented May 11, 2020

Thanks for the help. That's good news. It would be perfect to simply say something like <img ci-src="alain.jpg" ci-resize-orientation="vertical" /> where it would simply detect height and <img ci-src="alain.jpg" ci-resize-orientation="horizontal" /> which is what it does now (detect width).

@dzmitry-stramavus
Copy link
Member

@josgerrits nice idea, yes 👍

@tigerchick
Copy link

Hi, any further updates on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants