Can images of different sizes be dynamically called on websites? images of different sizes may be used in different locations and images of different sizes are required.
For example, if you have published an article, uploaded a title image, and generated an original 80*700 and a 100
If I want to call this image on the homepage and the size is 200*240, what should I do? is the width of the 580*700 source Image limited to 200? (Loading the source image affects performance)
When uploading an image, upload all the required size charts (this is not good, for example, I use different sizes on the home page or other pages, isn't it necessary to upload many images of different sizes)
Are there any good solutions?
Reply to discussion (solution)
The practice of our website is to store seven images of different sizes after passing a graph. these seven images are set as needed.
Then, call the image of the corresponding size at the corresponding position.
If the width and height of the img label are used to forcibly scale the webpage, the page will become stuck.
Generally, the storage space is reduced to various sizes.
Compare the traffic between 10 thousand KB and 10 KB, and set 10 pages to use this figure. the 10 pages are full for visitors every day, assuming that the client caches enough page views for one day (refreshing the page on the current day does not resend images)
100 k * 10*10000*30 = 300G/month
After the scale-out, it will be divided by 10, 30G/month.
This is just an image that is only used for 10 pages. it has not been computed for page refresh, more images, and more page calls (don't underestimate "reprinted ").
Therefore, the larger the site, the smaller the number of bytes of the image. of course, the larger the site is, the less traffic is required, and the service quality must be taken into account.
As for the image site display of the source image, that is from the perspective of service quality, and the source image is rarely displayed on multiple pages.
What I said upstairs is that the storage space is much cheaper than the traffic/bandwidth ....
Well, correct the preceding error. if the same image (with the same url) is cached by the client and the image already exists, no matter how many pages are cached, however, different browsers are indispensable.
Images of different sizes may be needed at different locations on the page
For example, if you have published an article, uploaded a title image, and generated an original 80*700 and a 100
If I want to call this image on the homepage and the size is 200*240, what should I do? is the width of the 580*700 source Image limited to 200? (Loading the source image affects performance)
When uploading an image, upload all the required size charts (this is not good, for example, I use different sizes on the home page or other pages, isn't it necessary to upload many images of different sizes)
Are there any good solutions?
How to design the database structure? There are seven different inch question maps. are seven fields created for storage?
Images of different sizes may be needed at different locations on the page
For example, if you have published an article, uploaded a title image, and generated an original 80*700 and a 100
If I want to call this image on the homepage and the size is 200*240, what should I do? is the width of the 580*700 source Image limited to 200? (Loading the source image affects performance)
When uploading an image, upload all the required size charts (this is not good, for example, I use different sizes on the home page or other pages, isn't it necessary to upload many images of different sizes)
Are there any good solutions?
How to design the database structure? There are seven different inch question maps. are seven fields created for storage?
For example
Video segment 123.jpg
Data warehouse 123.jpg
Seven pictures of different sizes are a_123.jpg B _123.jpg...
The database only saves one... prefix of the size when the program is called.
My approach is to use php ??? Birth? Size? Slice, such
Me ?? A.jpg is the original ?, ? In? ? Hou ?? Different sizes to the server? Server? ??? Use img. php ??? Original ?? Customer? Required size ,? ? Then directly? Outbound customers? End ,????? Outgoing? Film? Not directly saved? To the server? ,?? Good practice? Is it not stored? More ?? Neither? Heart traffic ??, But he ?? Service? Cpu? Capability.
A good idea.
My approach is to use php ??? Birth? Size? Slice, such
Me ?? A.jpg is the original ?, ? In? ? Hou ?? Different sizes to the server? Server? ??? Use img. php ??? Original ?? Customer? Required size ,? ? Then directly? Outbound customers? End ,????? Outgoing? Film? Not directly saved? To the server? ,?? Good practice? Is it not stored? More ?? Neither? Heart traffic ??, But he ?? Service? Cpu? Capability.
What is the response speed compared with direct file reading?
My approach is to use php ??? Birth? Size? Slice, such
Me ?? A.jpg is the original ?, ? In? ? Hou ?? Different sizes to the server? Server? ??? Use img. php ??? Original ?? Customer? Required size ,? ? Then directly? Outbound customers? End ,????? Outgoing? Film? Not directly saved? To the server? ,?? Good practice? Is it not stored? More ?? Neither? Heart traffic ??, But he ?? Service? Cpu? Capability.
What is the response speed compared with direct file reading? Than direct? ? How many instances are saved? Size? The film speed is slow for the following reasons: direct? Get saved? ? Slice only needs to be consumed ????, What do I do? Need cpu first? Whole? What is the size of the slice? Outbound customers? End, so one more? Step ?. How slow is it? Cpu speed.
My approach is to use php ??? Birth? Size? Slice, such
Me ?? A.jpg is the original ?, ? In? ? Hou ?? Different sizes to the server? Server? ??? Use img. php ??? Original ?? Customer? Required size ,? ? Then directly? Outbound customers? End ,????? Outgoing? Film? Not directly saved? To the server? ,?? Good practice? Is it not stored? More ?? Neither? Heart traffic ??, But he ?? Service? Cpu? Capability.
What is the response speed compared with direct file reading? Than direct? ? How many instances are saved? Size? The film speed is slow for the following reasons: direct? Get saved? ? Slice only needs to be consumed ????, What do I do? Need cpu first? Whole? What is the size of the slice? Outbound customers? End, so one more? Step ?. How slow is it? Cpu speed.
I understand, but this is a good idea. I didn't think of it before.
There should be some places to use, not commonly used images and so on
My approach is to use php ??? Birth? Size? Slice, such
Me ?? A.jpg is the original ?, ? In? ? Hou ?? Different sizes to the server? Server? ??? Use img. php ??? Original ?? Customer? Required size ,? ? Then directly? Outbound customers? End ,????? Outgoing? Film? Not directly saved? To the server? ,?? Good practice? Is it not stored? More ?? Neither? Heart traffic ??, But he ?? Service? Cpu? Capability.
What is the response speed compared with direct file reading? Than direct? ? How many instances are saved? Size? The film speed is slow for the following reasons: direct? Get saved? ? Slice only needs to be consumed ????, What do I do? Need cpu first? Whole? What is the size of the slice? Outbound customers? End, so one more? Step ?. How slow is it? Cpu speed.
I understand, but this is a good idea. I didn't think of it before.
There should be some places to use, not commonly used images and so on ?? Good practice? Is it just in the server? ? I? Original? Yes, no need to take the exam? More ???, Missing? Yes? Yes? External cpu ??
My approach is to use php ??? Birth? Size? Slice, such
Me ?? A.jpg is the original ?, ? In? ? Hou ?? Different sizes to the server? Server? ??? Use img. php ??? Original ?? Customer? Required size ,? ? Then directly? Outbound customers? End ,????? Outgoing? Film? Not directly saved? To the server? ,?? Good practice? Is it not stored? More ?? Neither? Heart traffic ??, But he ?? Service? Cpu? Capability.
What is the response speed compared with direct file reading? Than direct? ? How many instances are saved? Size? The film speed is slow for the following reasons: direct? Get saved? ? Slice only needs to be consumed ????, What do I do? Need cpu first? Whole? What is the size of the slice? Outbound customers? End, so one more? Step ?. How slow is it? Cpu speed.
I understand, but this is a good idea. I didn't think of it before.
There should be some places to use, not commonly used images and so on
I have also thought about this practice. for example, when I output a list of articles cyclically, each article must call img. php to output a thumbnail.
If the website has a high traffic volume, the website may become slow.
Images of different sizes may be needed at different locations on the page
For example, if you have published an article, uploaded a title image, and generated an original 80*700 and a 100
If I want to call this image on the homepage and the size is 200*240, what should I do? is the width of the 580*700 source Image limited to 200? (Loading the source image affects performance)
When uploading an image, upload all the required size charts (this is not good, for example, I use different sizes on the home page or other pages, isn't it necessary to upload many images of different sizes)
Are there any good solutions?
How to design the database structure? There are seven different inch question maps. are seven fields created for storage?
This process takes a long time to produce a lot of redundant images. Some images are never used on the website, but there will always be space occupied on the server.
If the traffic volume is high, do it honestly as a static file?
In image #1, convert an image whenever it is uploaded and save several fixed-size images ?? Yi Lao
Then, the appropriate size is called on different pages. although it is not necessarily the same as the page requirements, slightly changing the width/heigh with html has little impact ?? Bytes
Cdn caching is required for larger websites.
Dynamic generation of images puts too much pressure on the server. it is better to directly generate multiple formats. after all, hard disks are worthless.
If you are afraid that there are too many images, there are different folders by resolution during storage, and you can also delete the folders later.