Image processing-how to efficiently implement PHP image stitching

Source: Internet
Author: User
Recently, the idea was to extract images on the webpage through regular expressions and then splice the extracted images together. However, we encountered several problems and did not know how to solve them to generate spliced images more effectively. Because it is a PHP cainiao, I have just read some beginner knowledge, so the following practices are only available to myself... recently, the idea was to extract images on the webpage through regular expressions and then splice the extracted images together. However, we encountered several problems and did not know how to solve them to generate spliced images more effectively.

Because it is a PHP cainiao, I have just read some introductory knowledge, so the following practices are only applicable to my own capabilities.

My fundamental needs are:

1. Based on the URL address, obtain the content area image (about 10 images), splice multiple images into one image, and set the width of the spliced Image Based on my requirements, the height of the spliced image is the height of all the images that match the regular expression. The height is automatically added and spliced according to the width I have defined. Ensure that the image of each part is displayed properly after splicing.

Current practice:

1. Regular Expressions capture image URLs from a Web page --- download images ----- batch thumbnails of images (equal proportion to generate thumbnails) ---- and splice images with the GD library.

When the idea reaches implementation, I feel that the performance is very poor. There are multiple steps. Each step requires a long time to process the image, which can easily lead to timeout.

If you want to implement this process, you don't know how it is implemented. The method is the same as mine?

Reply content:

Recently, the idea was to extract images on the webpage through regular expressions and then splice the extracted images together. However, we encountered several problems and did not know how to solve them to generate spliced images more effectively.

Because it is a PHP cainiao, I have just read some introductory knowledge, so the following practices are only applicable to my own capabilities.

My fundamental needs are:

1. Based on the URL address, obtain the content area image (about 10 images), splice multiple images into one image, and set the width of the spliced Image Based on my requirements, the height of the spliced image is the height of all the images that match the regular expression. The height is automatically added and spliced according to the width I have defined. Ensure that the image of each part is displayed properly after splicing.

Current practice:

1. Regular Expressions capture image URLs from a Web page --- download images ----- batch thumbnails of images (equal proportion to generate thumbnails) ---- and splice images with the GD library.

When the idea reaches implementation, I feel that the performance is very poor. There are multiple steps. Each step requires a long time to process the image, which can easily lead to timeout.

If you want to implement this process, you don't know how it is implemented. The method is the same as mine?

Use imagemagick

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.