brunobandev / veganation

Vegan community.
https://veganation.com.br
MIT License
6 stars 0 forks source link

Change the current way of displaying categories' pictures #26

Open Morkhusz opened 4 years ago

Morkhusz commented 4 years ago

@brunobandev The current way that picture displaying is handled makes a little hard to others to contribute with the project.

For example: https://github.com/brunobandev/veganation/blob/8d740641a0f4fa5020fadc8ee67608af57e24cd4/resources/views/categories/index.blade.php#L15

Is dynamically creating a path (with the $category->id) which is harder to reproduce.

What do you think about storing the full image path on the picture column at categories table? This way we can call only asset($category->picture) and remove hard-coded paths.

It may be usefull for future storage migrations (maybe moving to AWS' S3 for example) and to new contributors.

brunobandev commented 4 years ago

Make sense, mate! :+1: Shall I save the extension together? Because I can have a thumb version... example: example.jpg, example_thumb.jpg what do you think?

Morkhusz commented 4 years ago

I believe that the "normal" picture and the thumb are two different things... Hopefully you will do something like $category->picture and $category->thumb to know that it's a thumb image. If you pretend to do a regex or some crazy stuff to identify if an image is a picture of thumb, well... I have bad news xD So, with that said, generally this things are stored with the full path + extension, e.g: /storage/categories/my_awesome_picture.jpg and /storage/categories/my_double_awesome_thumb.png

What do you think?

brunobandev commented 4 years ago

Sounds good to me. We can do this and think about gallery for the future.