Code for merging pictures using PHP shell commands _php Tutorial

Source: Internet
Author: User
Copy CodeThe code is as follows:
#!/usr/local/bin/php-q
Author:freemouse
Here is the description.
Print ("This program is used to merge 2 640x480-sized. \ n");
Print ("Picture, and convert it to a picture of 400x300 size \ n");
Print ("required to specify the default directory for pre-compositing pictures (a.jpg,b.jpg) \ n");
Print ("The resulting picture will be saved as c.jpg\n");

Default directory, edit it yourself ^_^
$d = "/home/freemouse/desktop";
Print ("current directory: $d \ n");

Print ("Picture a.jpg offset, 0-100:");
$fp = fopen ("Php://stdin", "R");
$a = fgets ($fp, 255);
Print ("Picture b.jpg offset, 0-100:");
$b = fgets ($fp, 255);
Fclose ($FP);
$a = $a *3.2;
$a =floor ($a);
$b = $b *3.2;
$b =floor ($b);

Zoom two images to 640x480 size
EXEC ("Zoom to 640x480-Mass 95".) $d. "/a.jpg");
EXEC ("Zoom to 640x480-Mass 95".) $d. "/b.jpg");

$AA = "Conversion-Mass 90-size 320x480+";
$ab = "". $d. "/a.jpg";
$BB = "". $d. "/b.jpg";
$ac = "". $d. "/aa.jpg";
$CC = "". $d. "/bb.jpg";

Save As aa.jpg after scaled a.jpg
$yy = $aa. $a. $ab. $ac;
Print ("$yy \ n");
EXEC ($YY);

Save As bb.jpg after scaled b.jpg
$zz = $aa. $b. $bb. $CC;
Print ("$zz \ n");
EXEC ($ZZ);

Merge two pictures for c.jpg.
$adjoin = "Synthesis-mass 80";
$adjoin. = $d. "/aa.jpg";
$adjoin. = $d. "/bb.jpg";
$adjoin. = $d. "/c.jpg";
Print ("$adjoin \ n");
EXEC ($adjoin);

Adjust c.jpg to 400x300 dimensions and add borders.
$edge = "Zoom to 400x300-mass 75-raise 4x4-sharpen 1x1". $d. "/c.jpg";
Print ("$edge \ n");
EXEC ($edge);

?>

http://www.bkjia.com/PHPjc/323658.html www.bkjia.com true http://www.bkjia.com/PHPjc/323658.html techarticle Copy the code as follows: #!/usr/local/bin/php-q author:freemouse? PHP//Below is the description. Print ("This program is used to merge 2 640x480-sized. \ n"); print ("Picture, and convert it ...

  • 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.