This example describes the PHP implementation in the Sina cloud using Imagick to generate thumbnails and upload the method. Share to everyone for your reference, specific as follows:
Imagick is a PHP image processing Plug-ins We can use Imagick to do a lot of the operation, let's look at a PHP in the Sina cloud using the Imagick method, the specific details are as follows.
PHP in the Sina cloud using Imagick to generate thumbnails and upload to storage method
<?php
//thumbnail
$tmpFile = ' yun_qi_img/';
List ($width, $height) = getimagesize ($tmpFile);
Resize if necessary
if ($width >= && $height >=) {
$image = new Imagick ($tmpFile);
$image->thumbnailimage (550,true);
/* Upload file to storage * * *
$st = new Saestorage ();
$tmp _url = Sae_tmp_path.time ()//Save to SAE temporary directory
file_put_contents ($tmp _url, $image);
$path = '/201608/22/1471856203_98548400.jpg ';
if (! $st->upload (' upload ', $path, $tmp _url)) {
echo 0;
} else {
echo $st->geturl (' upload ', $path);
}
}
? >
For more information on PHP related content readers can view the site topics: "PHP graphics and pictures Operating skills summary", "Basic PHP Grammar Introductory Course", "PHP Operations and Operator Usage Summary", "PHP object-oriented Program Design Introductory Course", "PHP Network Programming Skills Summary", "PHP array (Array) Operations tips Encyclopedia, "PHP string (String) Usage Summary", "Php+mysql Database operation Introduction Tutorial" and "PHP Common database Operation tips Summary"
I hope this article will help you with the PHP program design.