Open alekseyl opened 9 years ago
@alekseyl I am a little confused with the issue that you are facing. Is it like you get a large image, preview it, crop it and the cropped image is not what you set in the preview? And you face this issue only for large images?
I'm facing that problem too, I'll try my best to explain it successfully.
Both have the same dimensions (2560x1600), but while the first one is 3.5mb, the second one is just 1mb.
My CoverUploader saves three versions of that image: the original, the medium
and the cropped
. The first two ones are fine, but the last one is the black sheep.
include CarrierWave::RMagick
version :medium do
process resize_to_fit: [255, 9999]
end
version :cropped do
process crop: :cover
resize_to_fill 1140, 272
end
Thank you in advance.
Is it like you get a large image, preview it, crop it and the cropped image is not what you set in the >preview?
Yes
And you face this issue only for large images?
Yes only XXL images faced that problem. And only if displayed for cropping image dimensions is smaller than original dimensions.
I'm facing that problem too, I'll try my best to explain it successfully.
Are you sure that crop is correct in first place? I've seen little differences between preview and cropped_result, so it may crop incorrectly but the result may be close to the one is expected.
I've seen little differences between preview and cropped_result
Actually the image I put before the cropped one is the original image. Which preview are you referring to?
Hi I have a problem with your solution: If image is too large it's get resized by jCrop or browser ( didn't get quite well who is doing it ) ( For example when I tried 3000x2000 actually I get something near 1700x1400 ). And as a result cropped area is not as I expected ( it's smaller than you see in preview ).
I have Ad and photo instead of User and avatar, and using MiniMagick, so my monkey patch looked like this:
1) I added photo_displayed_height and photo_displayed_width accessors to model which owns attachment, so I can store in it size of photo actually displayed in browser
2) added them to form:
3) added this code to coffee:
4) AND the most important part in processors I reprocess attributes ( it can be done also in the controller ):