简体   繁体   中英

How to reduce the size of assets in web application

In my app(tourism), We have used lot of images(png and gif) and now we need to reduce the assets size(image/gif/png).

  1. Already tried the base64 convertion as a json. As this blog stated base64 encoded image size while converting an image into base64, it will create a larger file.
  2. Second options is store images in DB and load them (I think, this is not suitable in my case)

Is there's an alternative way to reduce the assets size, Thanks in advance.

Image size could be reduced in multiple ways (trading image quality). It might solve your problem now but it will never scale with a number of images/assets.

Assets storage

Any cloud provider has a product for storing assets, where AWS's S3 storage is most recognized. This storage type is ideal for your case, it's fast, reliable and cheap. A custom solution could be used if using the services of a cloud provider is not an option.

Caching static files

Static assets as images are the ideal candidates for caching. They are called Content Delivery Network (CDN) and there are dozens of providers who offer such product. Make sure your application uses E-tags

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM