X3 Photo Gallery Support Forums

Topic Author
Posts: 6
Joined: 07 Jun 2017, 18:13

Resizing images differently on Mobile and Desktop

02 Aug 2023, 14:45

I want to resize images to a percent in DESKTOP, while not resizing in MOBILE.
I could not find any clue how to detect reliably when desktop or mobile.
Any clue?
User avatar
X3 Wizard
Posts: 14012
Joined: 30 Sep 2006, 03:37

Re: Resizing images differently on Mobile and Desktop

03 Aug 2023, 10:05

It's a bit unclear about what your plan is here. If you DON'T resize on mobile, then how are images supposed to fit on the screen? Let's say you have an image 640 px wide, an iPhone 11 is 414 px, then the image will only be half visible. Also, there are iPads that are not quite desktop sized, but definitely not mobile size ... Technically, there is no "desktop" or "mobile". If you have any links to any website using this, please post the link, because honestly it doesn't sound like good planning.

The normal approach to scaling images would be 1. max-width 100%, so that the image will scale down nicely on small screens, while remaining fully visible. 2. For "desktop" screens larger than 1024 px (for example), you would normally assign a fixed width ... you could assign width as percentage in special cases for desktops.