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

Already on GitHub? Sign in to your account

Images don't keep aspect ratio on resize #338

Closed
holgersindbaek opened this Issue Mar 13, 2013 · 9 comments

Comments

Projects
None yet
2 participants
Contributor

holgersindbaek commented Mar 13, 2013

I'm trying to embed an image like this:

<img style="width:260px; height:auto;" src="Makerminds_Logo.jpg">

Problem is that the image doesn't keep the ratio. It resizes the image to the new width, but the height stays the same as the old height.

Am I doing something wrong here?

Contributor

holgersindbaek commented Mar 13, 2013

All I had to do was to use this code instead:

<img width=260 src="Makerminds_Logo.jpg">
Collaborator

odrobnik commented Mar 13, 2013

Is auto a valid measurement? If yes, them we could add behavior to ignore it because that is the default behavior.

Contributor

holgersindbaek commented Mar 13, 2013

I don't know exactly what you mean by "valid". I googled how to resize an image and keep the aspect ratio and some people seem to do it this way.

The other way that I ended up doing it works great though. Seems like a lot of work has gone into this awesome library. Really thrilled!

@odrobnik odrobnik added a commit that referenced this issue Mar 13, 2013

@odrobnik odrobnik Added unit test for #338 4748dd9

@odrobnik odrobnik added a commit that referenced this issue Mar 13, 2013

@odrobnik odrobnik Moved setting of the display size to after styles have been applied
This fixes a bug where the max display size would not be heeded since version 1.3.
Also fixes #338
99da4df

@odrobnik odrobnik added a commit that referenced this issue Mar 13, 2013

@odrobnik odrobnik Added setDisplaySize:withMaxDisplaySize: to automatically calculate m…
…issing dimensions

Also for #338
48aad8d
Collaborator

odrobnik commented Mar 13, 2013

@holgersindbaek Thank you for noticing this issue. It turns out that it was only a symptom of a larger problem: the maximum display size was being ignored. I moved the displaySize handling to after the parsing of the styles.

Contributor

holgersindbaek commented Mar 17, 2013

Nice one!

@Cocoanetics When can I pull this version with CocoaPods?

Even though I have ":head" in my Podfile, it doesn't seem to pull this version:

pod 'DTCoreText', :head
Collaborator

odrobnik commented Mar 17, 2013

The head only means that it takes the highest pod version, not the head of the repo.

Best regards
Oliver Drobnik

@Cocoanetics on Twitter and App.net
www.cocoanetics.com

On 17.03.2013, at 01:32, holgersindbaek notifications@github.com wrote:

Nice one!

@Cocoanetics When can I pull this version with CocoaPods?

Even though I have ":head" in my Podfile, it doesn't seem to pull this version:

pod 'DTCoreText', :head

Reply to this email directly or view it on GitHub.

Contributor

holgersindbaek commented Mar 17, 2013

@Cocoanetics Arhhh, ok.

When will you include it in the latest cocoapod version?

Collaborator

odrobnik commented Mar 17, 2013

I do a new version and release whenever I feel that problems have quieted down a bit. I hate to release something only to get another bug report right after it.

You could create your own spec file that always takes the latest version to help making sure that everything works smoothly.

Yesterday I changed the way how he thinkness and position of underline and strikeout look and I am uncertain that this is optimal on non-Retina and Retina. I need for another pair of eyses to try this out and tell me that it is ok.

Best regards
Oliver Drobnik

@Cocoanetics on Twitter and App.net
www.cocoanetics.com

On 17.03.2013, at 06:19, holgersindbaek notifications@github.com wrote:

@Cocoanetics Arhhh, ok.

When will you include it in the latest cocoapod version?


Reply to this email directly or view it on GitHub.

Contributor

holgersindbaek commented Mar 17, 2013

I understand.

Turns out I can just do this in my Podfile and I'll get the current version from this repository:

pod 'DTCoreText', :git => 'https://github.com/Cocoanetics/DTCoreText.git'

The image scaling works great now, btw.

Keep up the good work :-).

@ghost ghost assigned odrobnik Mar 21, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment