Code for merging pictures using PHP shell commands _php Tips

Source: Internet
Author: User
Copy Code code as follows:

#!/usr/local/bin/php-q
Author:freemouse
<?php
Here is the description.
Print ("This program is used to merge 2 640x480 sizes. \ n");
Print ("Picture, and convert it to a picture of 400x300 size \ n");
Print ("You need to specify the default directory for the pre-synthetic picture (a.jpg,b.jpg)" \ n ");
Print ("The generated picture will be saved as c.jpg\n");

Default directory, edit it yourself ^_^
$d = "/home/freemouse/desktop";
Print ("Current directory is: $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 picture to 640x480 size
EXEC ("Zoom to 640x480-quality 95"). $d. "/a.jpg");
EXEC ("Zoom to 640x480-quality 95"). $d. "/b.jpg");

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

A.jpg saved as aa.jpg after zooming
$yy = $aa. $a. $ab. $ac;
Print ("$yy \ n");
EXEC ($YY);

B.jpg saved as bb.jpg after zooming
$zz = $aa. $b. $bb. $CC;
Print ("$zz \ n");
EXEC ($ZZ);

Combine 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 the c.jpg to 400x300 dimensions and add a border.
$edge = "Zoom to 400x300-quality 75-raise 4x4-sharpen 1x1". $d. "/c.jpg";
Print ("$edge \ n");
EXEC ($edge);

?>

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.