rsantamaria / papercrop

An easy extension for Paperclip to crop your image uploads using jCrop.
203 stars 83 forks source link

Crop preview zoomed into photo #33

Closed tgoldenberg closed 9 years ago

tgoldenberg commented 9 years ago

I have the crop set up as recommended in the README, but the preview is showing a much zoomed in image, which is also being saved. How can I get the two images to match in size / zoom? This would be very helpful, thanks!

andyweiss1982 commented 9 years ago

Hello, I am experiencing the same problem. Screenshots are attached below. @tgoldenberg Were you ever able to resolve this?

screen shot 2015-09-21 at 11 14 42 am screen shot 2015-09-21 at 11 15 08 am screen shot 2015-09-21 at 11 19 00 am

tgoldenberg commented 9 years ago

Hi, this was a while ago, so I'm not sure how I dealt with this :/

andyweiss1982 commented 9 years ago

thanks @tgoldenberg.
@rsantamaria do you have any advice?

rsantamaria commented 9 years ago

Hi @andyweiss1982, sadly I can't reproduce the glitch... what is your original image resolution? and what browser/version are you using?

andyweiss1982 commented 9 years ago

Hi @rsantamaria thanks for following up.

I have the same error in both Chrome Version 45.0.2454.99 (64-bit) and Safari Version 8.0.8 (10600.8.9).

I have tried a few different resolutions, such as:

3648 × 5472 2894 × 4090 5179 × 3453

All have the same problem. I even tried copying through the landscape model, controller and views from the rails 4 sample app.

andyweiss1982 commented 9 years ago

@rsantamaria it's strange because I have cloned the test app and everything works just fine -- same pics and browsers. So the error must be on my end somewhere but can't tell where -- is there a recommended paperclip / rails version I should try?

rsantamaria commented 9 years ago

@andyweiss1982 what's your paperclip version?

stewartmckee commented 9 years ago

I've had a similar issue, i've sorted the preview by overriding a max-width that had been set on all images to 100%.

#crop img {
  max-width: none;
}

This seems to have sorted a similar issue to this that I was seeing. I now have some issues with the actual crop, i'm sometimes getting a slightly smaller crop than selected and sometimes just black, although i'm seeing errors from the convert command, so need to look further into that. The max-width might sort your issue though.

rsantamaria commented 9 years ago

Thank you @stewartmckee. You're right, it's totally the case mentioned in issue #23. At first I didn't give importance to this because resolving every conflict that any plugin could do is a lost war but looks like this issue is more common than I thought.

stewartmckee commented 9 years ago

Ah, cool, didn't even see that post! You could possibly override the css for that specific image by default and allow the resetting to be disabled in an option i suppose. BTW i also left a comment on the Railscast episode around jcrop pointing them here, its at the bottom of a ton of posts so no-one will probably ever read it, but papercrop has certainly saved me time! Thanks!

rsantamaria commented 9 years ago

Done 5234eecc456cb47ccd16c7b30b771c1256b1245a This should do the trick, the inline css could be overridden with !important in the stylesheets if needed.

abhishekjain16 commented 9 years ago

@rsantamaria I am not sure but this solves only preview image issue.

But there seems to an issue with actual crop too. The image zooms and crops when large image is uploaded. Anyone still facing similar issue?

davidmccoy commented 8 years ago

I'm experiencing the same issue. Using Paperclip 4.3.5 and Papercrop 0.3.0.

As far as I can tell, the original photo is being resized correctly (500px wide, like the original post). However, the preview image does not scaled based on the resized photo's dimensions—instead, it is using the original (much larger) photo size. Thus the preview looks like it is zoomed in.

Any advice on how to solve this would be greatly appreciated, @rsantamaria.

trusche commented 7 years ago

@davidmccoy I ran into the same issue. It's due to this line:

https://github.com/rsantamaria/papercrop/blob/master/lib/assets/javascripts/papercrop.js#L42

which uses an arbitrary default with and height of 250px of the original image for the selected area. This commit uses the original image dimension instead to default to the largest possible area (constrained by the aspect ratio).

trusche commented 7 years ago

Aaaaaand turns out there are multiple pull requests already doing the same and more:

@rsantamaria, first of all thanks for this very helpful gem. Are you planning on maintaining it, given the number of open pull requests? I'd be happy to volunteer my help if needed.

davidmccoy commented 7 years ago

@trusche you are correct! I found those solutions in the pull requests and should have updated here. 😄

rsantamaria commented 7 years ago

@davidmccoy @trusche Thank you! Yes, I have plans to continue with it but I've been very busy last year and the gem is not maintained at all, sorry. In a month or so I'll have some free days to put some order here.

davidmccoy commented 7 years ago

@rsantamaria thanks for the update! And for originating this gem.