PawCorp / walltaker

Take control of your friends wallpapers
12 stars 11 forks source link

[Enhancement] Wallpaper preview selector #43

Open gios2 opened 2 years ago

gios2 commented 2 years ago

It would be useful to be able to set in the link settings how the preview of the wallpaper should be shown, for users who for example use the monitor vertically, in order to show the correct preview. As previews there should be at least: smartphone, tablet portrait, tablet landscape, vertical monitor, horizontal monitor

pupgray commented 2 years ago

Makes sense! I imagine this as NOT a restriction on the wallpapers that can be posted (blocking if wrong ratio) since sometimes the cropping is desirable (a wide picture could crop well on a vertical phone)

This would just be for the preview area.

pupgray commented 2 years ago

For anyone trying this as a first issue:

This would require a new migration to add a "preview_type" (suggested name) column to the links table. I'd suggest making a bigint, so you can use rail's enum in the model. This will let you instead use it with symbols like :smartphone_portrait to interact with this column.

Then, inside the app/views/links/_details.html.erb view, depending on the value of this column for a given link, display a cropped preview approximating the ratio of hight and width of a device, replacing the current janky solution that uses an icon of the device