Php implements the use of imagick in Sina cloud to generate and upload thumbnails.
This example describes how php can use imagick to generate thumbnails and upload them on Sina cloud. We will share this with you for your reference. The details are as follows:
Imagick is a php image processing plug-in. We can use imagick to perform many operations. Let's take a look at how php uses imagick on Sina cloud, the details are as follows.
Php uses imagick in Sina cloud to generate thumbnails and upload them to Storage
<? Php // thumbnail $ tmpFile = 'HTTP: // XXXX.com/original.jpg'; list ($ width, $ height) = getimagesize ($ tmpFile ); // resize if necessary if ($ width >=550 & $ height >=550) {$ image = new Imagick ($ tmpFile); $ image-> thumbnailImage (550,550, true);/* upload a file to Storage */$ st = new SaeStorage (); $ tmp_url = SAE_TMP_PATH.time (); // save it to the temporary directory file_put_contents ($ tmp_url, $ image); $ path = '/201608/22/1471856203_98548400.jpg'; I F (! $ St-> upload ('upload', $ path, $ tmp_url) {echo 0;} else {echo $ st-> getUrl ('upload ', $ path) ;}}?>