As a novice PHP site development, often easy to ignore the development of Web site URL (directory) planning work, when the development of PHP site types involving a large number of attachment upload, such as Picture class site, the early days if not do a good picture of the URL (directory) planning, later picture management will be very troublesome, Today David will share with you how to use a PHP program to migrate pictures when you encounter this situation. Before the image migration, you need to according to the situation of the site to do a picture of the URL (directory) planning, in principle, not too deep directory structure, otherwise it is not conducive to SEO.
Because it is a travel site and has only one Linux server, David uses PHP programs to migrate pictures, as well as to the environment of a virtual host.
PHP Image Migration Ideas :
1. Get a picture of each scenic spot in a province.
Note : Considering the efficiency of the program, we recommend that you do not all of a sudden batch processing all pictures, easy to die. You can set different conditions according to the situation of the website.
2, according to the URL planning, in the relevant directory to create a picture URL directory folder, David's URL directory structure: images/picture type/month/date/file name
3, according to the type of picture (Tour map, traffic map, scenic map), the different types of picture information stored in the database and migrated to the relevant directory, if you need to deal with the picture, you may need to zoom to the picture, add watermark and other operations.
Note : When the picture is in storage, David is based on the picture URL of the plan, deposited in the picture part of the URL information, such as Picture address: www.leapsoul.cn/images/jd/0905/26/test.jpg, warehousing information for the jd/ 0905/26/test.jpg
So if the image URL changes later, but also more aspects of the operation, of course, you can also according to your site's directory planning to do what you need to do the operation.
Other work
In the PHP image migration work completed, if your site has been a large number of included, you need to do URL rewrite work to ensure that the quality of search engines included.
PHP Picture Migration Summary
First of all need to do URL planning (see you in the establishment of the site to consider a good URL planning problem), and then dynamically create a URL directory structure, and then according to the specific circumstances, set conditions to obtain picture information, the picture after processing according to the layout of the URL to the specific directory. Finally, URL overrides or redirects are required.
OK, through the above instructions, about how to use the PHP program to migrate pictures of the work completed, if you have a better way can also give me a message, the next time will share how to split the picture, thereby reducing the bandwidth pressure on the Web server.
Note : PHP Web Development Tutorials-leapsoul.cn Copyright, reproduced in the form of links to indicate the original source and this statement, thank you.