POST üzerinden JSON alır ve bir görüntüyü geri tükürür php Webcoder

0 Cevap php

(Preamble: This seems like such a typical thing to want to do that I was surprised I didn't immediately find examples and tutorials about it. So I thought it would be valuable to have as a StackOverflow question. Pointers to related examples and tutorials will certainly be welcome answers.)

To make this concrete, the goal is a webservice that accepts data in JSON format via a POST request. The data is simply an array of single-digit integers, e.g., [3, 2, 1].

On the server are images named 0.png, 1.png, 2.png, etc. The webservice takes the images corresponding to those specified in the JSON array and composes them into a montage, using the standard ImageMagick command line tool. For example,

montage 3.png 2.png 1.png 321.png

hepsi üst üste 3.png, 2.PNG ve 1.png, oluşan yeni tek bir görüntü, 321.png oluşturur.

The accepted answer will be in the form of complete PHP code that implements the above. (I'll write it if no one beats me to it.)

0 Cevap