Osclass Support Forums

General osclass questions => Report bug => Topic started by: sebastian on May 03, 2021, 04:05:59 PM

Title: Listing image is not cropped on mobile
Post by: sebastian on May 03, 2021, 04:05:59 PM
Hi,

When i try to add an image for a listing (on mobile), the image is not cropped and will display larger than any other listing images (see attachment)
This bug manifest only on mobile. It doesn't matter the resolution, if the picture is vertically, it will make the thumbnail bigger then the rest, including the slider when viewing the listing.

Notice: first take the picture, then try to add or update listing

I have tried best image crop and force image aspect. Same problem.

I am using latest version of osclass and gama theme and ImageMagick enabled
Title: Re: Listing image is not cropped on mobile
Post by: MB Themes on May 03, 2021, 04:52:43 PM
@sebastian
Oc-admin > settings > media > force image aspect.
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 03, 2021, 05:36:57 PM
I don't understand your answer. I know very well how to configure the theme. I know I have "best image crop" and "force image aspect" options, but this don't fix the bug.
Title: Re: Listing image is not cropped on mobile
Post by: MB Themes on May 03, 2021, 05:38:39 PM
Then disaable both and regenerate images
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 03, 2021, 06:06:06 PM
I have tried everything before posting the bug. Enabled and disabled. Same problem
Title: Re: Listing image is not cropped on mobile
Post by: MB Themes on May 03, 2021, 07:57:28 PM
I would call that as impossible  :)
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 03, 2021, 09:03:35 PM
Please do the following steps to reproduce the bug:

ON MOBILE PHONE

1. take a picture with your phone
2. click "Add new listing" or "Edit existing one" and insert photo from Step 1
3. publish listing
4. view listing

You will see the bug when viewing the listing. See attachments
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 03, 2021, 09:08:30 PM
You can try anything in Settings -> Media:
- enable/ disable "best image crop"
- enable/ disable "force image aspect"
- disable both "best image crop" and "force image aspect"
- regenerate images
- tested on different phones, different images: landscape or portrait
- etc

The bug is still there
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 03, 2021, 11:12:14 PM
IMPORTANT:

I think the bug manifest on images with size > 2mb
Phone pictures have around 7-13mb depending on the phone.

Photos with small sizes (kb) don't manifest the BUG!
Title: Re: Listing image is not cropped on mobile
Post by: MB Themes on May 04, 2021, 08:28:14 AM
Please do the following steps to reproduce the bug:

ON MOBILE PHONE

1. take a picture with your phone
2. click "Add new listing" or "Edit existing one" and insert photo from Step 1
3. publish listing
4. view listing

You will see the bug when viewing the listing. See attachments

This looks more like bug of bxslider library that is trying to keep all images of "same size". Can you provide URL to this listing?
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 04, 2021, 08:35:37 AM
https://totulgratis.ro/sport-timp-liber-si-arta/box/manuși-box_i41

Its not just the slider, also thumbnail on home page is larger then the rest if I put that image first
Title: Re: Listing image is not cropped on mobile
Post by: MB Themes on May 04, 2021, 08:50:48 AM
@sebastian
https://totulgratis.ro/oc-content/uploads/0/114.jpg
https://totulgratis.ro/oc-content/uploads/0/87.jpg

If you compare these images, they have dimension 640x480 and 480x640, that sounds for me like orientation of first image was rotated after it was stored.
Can you mail original images to [email protected]? Will play with it for a while
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 04, 2021, 09:06:46 AM
Yes, same image rotated is ok. But vertical image is not
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 04, 2021, 09:07:50 AM
Hint:

Bug DO NOT manifest when:
- phone image is shared on WhatsApp (gets resized), then re-upload it to my listing
- phone image is taken instantly by phone camera when adding the listing
- any resolution image from internet (for example 1900x1080 or 1500x1000) with size in kb not mb

Only if I do the 4 steps mentioned in my earlier post, I see the bug
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 04, 2021, 09:56:11 AM
@sebastian
https://totulgratis.ro/oc-content/uploads/0/114.jpg
https://totulgratis.ro/oc-content/uploads/0/87.jpg

If you compare these images, they have dimension 640x480 and 480x640, that sounds for me like orientation of first image was rotated after it was stored.
Can you mail original images to [email protected]? Will play with it for a while

You can take a picture with your phone and play with it, it's the same thing. It's not just this specific image, any image will have same problem if it's taken with phone and then added to listing.

In attachment: see behaviour of same picture resized by social media, then re-uploaded to my listing (pic2.png)
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 05, 2021, 08:57:16 AM
Is there any way I can fix this?
Title: Re: Listing image is not cropped on mobile
Post by: MB Themes on May 05, 2021, 11:11:48 AM
@sebastian
I was not able to test this yet as working on something different, but it may be bug also with fineuploader library, anyway may be hard to debug and fix problem.
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 05, 2021, 11:39:29 AM
I know you have many request from all users and it is hard to fix them all in a short notice. Thanks for taking your time to reply.
I am trying myself to find a fix via CSS.
Please keep in mind this bug, maybe you will have time in the future to find a fix, because it's kinda important. The most common behaviour of posting a listing is this:

1. take photo first
2. go to site and add new listing
3. insert photo from step 1 to the listing

and it will cause the visual disalignment in site because of the bug
Title: Re: Listing image is not cropped on mobile
Post by: MB Themes on May 05, 2021, 12:18:22 PM
I do not think it has something to do with css, it is rendering issue probably
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 05, 2021, 12:29:05 PM
I know it's not CSS problem, but to find a temporary fix, CSS is my only option :)

Also it's strange that same picture taking "instantly" when adding listing have no problem but uploading a picture from phone have problem. Very weird
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 07, 2021, 10:35:52 AM
I played around with the images to find more details about the Bug. Here is what I found:

- any picture taken with phone VERTICALLY (keep original image - unaltered) and then added to a listing, the image is not cropped and will display larger then the rest

- if you open the original image in Windows and you rotate it and just close the image (no save), then re-upload to the listing, it will display ok (no bug)

- if you take the picture instantly with phone when adding the listing, it will display ok (no bug)

- if original image (the vertical one) is resized in mb by any tool (email, social media, etc), it will display ok (no bug)

See attachment (instant picture vs previously taken picture). This will generate larger thumbnail, preview and normal image

I hope this info helps you in finding the solution of bug
Title: Re: Listing image is not cropped on mobile
Post by: MB Themes on May 07, 2021, 12:23:45 PM
@sebastian
I would say that images (on your screenshot) were both cropped, but:
- first image has proper orientation and size 640x480
- second image has incorrect orientation, is rotated and has size 480x640 (instead of 640x480).

Good questions are:
- if image has always size 640x480 px  (based on media settings). If yes, should be much simpler to fix
- if same problem can be observed using GD library as well as ImageMagick. Not sure if GD will be able to manage such large images.
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 07, 2021, 01:08:33 PM
Question 1 - in media settings (see attachment)
Question 2 - gd library only support 2mb pictures and as I said, if the image is resized from X mb to 2mb, it works with ImageMagick (no bug)
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on May 11, 2021, 07:33:27 PM
Some more useful info about the bug:

https://stackoverflow.com/questions/32430121/how-to-resize-without-rotation-with-imagemagick

https://legacy.imagemagick.org/discourse-server/viewtopic.php?t=33900

There is something about image rotation after uploaded. If phone image is vertically, it will be rotated on upload
Thumbnail, preview and normal will display larger as i said before
Title: Re: Listing image is not cropped on mobile
Post by: MB Themes on May 11, 2021, 08:30:22 PM
I remember rotating was disabled or something with rotation was made, as it was not reliable.
Not having too much time for it now but have it on list so please be patient :)
Title: Re: Listing image is not cropped on mobile
Post by: sebastian on June 15, 2021, 01:24:31 PM
Any updates on this issue?