Version: 1.0
Type: Full Script
Category: Graphics
License: zlib/libpng License
Description: This will combine 2 pictures. 50% on left and 50% on right. It will also scale down to 400×300 for ebay and put a border around it.
This script runs on command line if imagemagick and php standalone are installed.
#!/usr/local/bin/php -q Written by William L. Berggren Public Domain - Free <?php // wow you don't even need print statements. // shaabang line, -q suppresses html headers print ("The purpose of this program is to merge 2 640x480.n"); print ("pictures - or similar ratio - into a 400x300 picturen"); print ("This is for ebay. Initally this will only be done byn"); print ("cropping in the x-axis (Left-Right). You must edit then"); print ("default directory. This will be the path to a.jpg and b.jpgn"); print ("Imagine a scale from 0-100 that starts at 0 on then"); print ("left side of the picture, and 100 in the middle. Entering 50n"); print ("will crop 25% off the left side and 25% from the right siden"); print ("of the picture. Picture names will always be a.jpg for n"); print ("the left picture, and b.jpg for the right picture.n"); print ("c.jpg will be the combined picture n"); print ("DEPENDICIES, are imagemagick and php standalonen"); print ("this is easy to test enter convert, mogrify, and php n"); print ("at the command line and something should happen. n n"); //default directory, EDIT THE FOLLOWING LINE $d="/home/bill/Desktop"; print ("The present directory is named: $dn"); 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); // resizes pictures a,b to 640x480 exec("mogrify -scale 640x480 -quality 95 " . $d . "/a.jpg"); exec("mogrify -scale 640x480 -quality 95 " . $d . "/b.jpg"); $aa = "convert -quality 90 -crop 320x480+"; $ab = " " . $d . "/a.jpg"; $bb = " " . $d . "/b.jpg"; $ac = " " . $d . "/aa.jpg"; $cc = " " . $d . "/bb.jpg"; // crops picture a.jpg and saves it as aa.jpg $yy = $aa . $a . $ab . $ac; print ("$yyn"); exec($yy); // crops picture b.jpg and saves it as bb.jpg $zz = $aa . $b . $bb . $cc; print ("$zzn"); exec($zz); // joins the 2 pictures, as picture c.jpg. $adjoin = "convert -quality 80 +append "; $adjoin .= $d . "/aa.jpg "; $adjoin .= $d . "/bb.jpg "; $adjoin .= $d . "/c.jpg"; print ("$adjoinn"); exec($adjoin); // resizes picture c.jpg to 400x300 and adds border. $edge="mogrify -scale 400x300 -quality 75 -raise 4x4 -sharpen 1x1 " . $d . "/c.jpg"; print ("$edgen"); exec($edge); ?>