PHP implementation in the Sina cloud using Imagick to generate thumbnails and upload the method _php skills

Source: Internet
Author: User

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.

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.