meumobi / infomobi

Ionic2 Employee App
3 stars 2 forks source link

How to use responsive images on known context #179

Open vdias38 opened 6 years ago

vdias38 commented 6 years ago

Expected behaviour

Since resizing images study we know for each context (comment.picture, profile.picture, etc.) which image sizes we expect. We should provide an easy way to use expected responsive img on each know context without to need to configure required sizes on each template.

Actual behaviour

We apply ImgServerSrcsettifyPipe to set img@SrcSet, but not consider context, then all srcset are same.

Expected responses

vdias38 commented 6 years ago

Should create a component for each use case, for example <comment-picture src="..." alt="..." />. It should be responsible to render the responsive img like:

<img srcset="
    elva-fairy-600w.jpg 600w,
    elva-fairy-900w.jpg 900w,
    elva-fairy-1200w.jpg 1200w"
  sizes="
    (max-width: 800px) 600px,
    (max-width: 1024px) 900px,
    1200px"
  src="elva-fairy-900w.jpg" alt="Elva dressed as a fairy" />

Recommended sizes:

Screen sizes considered: 800, 1024, 2048 px. For each screen size we'll define an img size: small, medium and large.

The TV page could be considered as a separate case because the width of screen is divided on 2 views: live and items. Then the live view on it only represent 1/3 of whole width screen.

Layout

The comment.picture take almost the entire width screen, there are tiny margin/padding, resulting on a 16|40| comment-picture |8 layout.

danconte72 commented 6 years ago

img-avatar

How to use component

<img-avatar [src]="" (click)="action"></img-avatar>

Components:

danconte72 commented 6 years ago

img-comment

How to use component

<img-comment [src]="src"></img-comment>
vdias38 commented 6 years ago
danconte72 commented 6 years ago

img-items-thumbnail

How to use component

<img-items-thumbnail [src]="src"></img-items-thumbnail>
danconte72 commented 6 years ago

I was checking and img-items-details has the same rules for img-comment.

danconte72 commented 6 years ago

img-item-details

How to use component

<img-item-details [src]="src"></img-item-details>
danconte72 commented 6 years ago

img-medias-thumbnail

How to use component

<img-medias-thumbnail [src]="src"></img-medias-thumbnail>
danconte72 commented 6 years ago

Item.thumbnails is an array of {url:”url”, width: “width”, height: “height”}

danconte72 commented 6 years ago

Another youtube option

vdias38 commented 6 years ago

We can use a an higher thumb from sitebuilder updating size config and remove youtube thumbs.

danconte72 commented 6 years ago

I've add a new content and re-donwloaded the infomobi app and none call to a thumbnail file.

danconte72 commented 6 years ago

To remove yt from thumbs on sitebuilder.item we must to add a filter to only get medias.thumbnails from medias where type are not application/vnd.youtube.video+html image

danconte72 commented 6 years ago

format

1200x800 size: jpg 169KB / png 1,2MB 200x200 size: jpg 17KB / png 78KB

add &format=jpg on imgflow requests

danconte72 commented 6 years ago

new doc https://github.com/meumobi/ion-employee/wiki/Image-Components