Basics:
I want to be able to run a script more than once using a foreach loop with an include (code below):
Code: Select all
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
$path = '/opt/local/bin/';
$order[0]['type'] = "beach";
$order[0]['first'] = "chris";
$order[0]['second'] = "amanda";
$order[1]['type'] = "chairs";
$order[1]['first'] = "chris";
$order[1]['second'] = "amanda";
$order[2]['type'] = "golf";
$order[2]['first'] = "chris clemmons";
$order[3]['type'] = "heart";
$order[3]['first'] = "chris";
$order[3]['second'] = "amanda";
$order[4]['third'] = "6/10/10";
$order[4]['type'] = "lakeside";
$order[4]['first'] = "chris";
$order[4]['second'] = "amanda";
$order[5]['type'] = "stadium";
$order[5]['first'] = "chris clemmons";
$order[6]['type'] = "swan";
$order[6]['first'] = "chris";
$order[6]['second'] = "amanda";
$order[7]['type'] = "wine";
$order[7]['first'] = "chris";
$order[7]['second'] = "clemmons";
$order[8]['type'] = "horse";
$order[8]['first'] = "chris";
$order[8]['second'] = "amanda";
$c=1;
foreach($order as $o) {
$first = $o['first'];
$second = $o['second'];
$third = $o['third'];
include($o['type'].'/script.php');
$c++;
}
If you haven't guessed, if it could run through the loops without holding up on running one script at a time it would render much faster depending on the server spec's (cpu/ram etc...). I have also tried calling the script through exec() with no $return but it still waits until it's finished.
Example from one of the scripts:
Code: Select all
<?php
$bg = 'heart/back/bg.jpg';
$font = 'heart/font/itcblk.ttf';
$final = '_FINAL/';
$text = $first;
$text3 = $second;
$text3 = $third;
$text = ucfirst(strtolower($text)).' &';
$text2 = ucfirst(strtolower($text2));
$text3 = date('m.d.y', strtotime($text3));
$compolay = $path.'convert -size 500x170 -gravity center -background none -fill "#010101" -font '.$font.' label:"'.$text.'" comp1.png';
exec($compolay, $result);
$compolay = $path.'convert -size 500x170 -gravity center -background none -fill "#010101" -font '.$font.' label:"'.$text2.'" comp2.png';
exec($compolay, $result);
$compolay = $path.'convert -size 500x170 -gravity center -background none -fill "#010101" -font '.$font.' label:"'.$text3.'" comp3.png';
exec($compolay, $result);
$finalout = $path.'convert '.$bg.' comp1.png -geometry +970+1350 -composite comp2.png -geometry +970+1470 -composite comp3.png -geometry +970+1570 -composite -compress jpeg '.$final.$c.'final.pdf';
exec($finalout, $result);
exec('rm comp1.png comp2.png comp3.png', $result);
?>
So just curious if anyone out there would know of such a way of doing this.
Thanks