Jump to content

Archived

This topic is now archived and is closed to further replies.

jsorenson3

Image Create Question

Recommended Posts

I am using the following code to fill in the blanks on an image from an online form. Everything is complete.

However, there are several manufacturers that we have that require a specific form. We have a generic form for everyone else and 8 people that have different agreements.

If the person filling out the form chooses one of the 8 that is listed it will know to use the other document instead of the generic one already specified

Here is the code that i have. I have submitted only for the first file because that is the one that needs to check.

the name of the field is Products_Sold

If the option chosen would be Cars then it would use the generic form and would use the code as listed, but if they chose Trucks it would create the image on a different filename


[code]
$filename1 = "bfcmai1.JPG";
$filename2 = "bfcmai2.JPG";
$filename3 = "bfcmda1.jpg";
$filename4 = "bfcmda3.jpg";



$dest_loc = "newdlr_data";

//ftp information to make the file
$ftp_server = "ftpinfohere";
$ftp_user = "user";
$ftp_pass = "pass";



$im = @imagecreatefromjpeg($filename1);
$textcolor = imagecolorallocate($im, 0, 0, 0);
$font = 'arial.ttf';
$fontsize = "24";

//insert text onto the page
imagettftext($im, $fontsize, 0, 258, 383, $textcolor, $font, $Company_Name);

imagettftext($im, $fontsize, 0, 246, 445, $textcolor, $font, $Contact_Person);
imagettftext($im, $fontsize, 0, 912, 445, $textcolor, $font, $Title);
imagettftext($im, $fontsize, 0, 152, 508, $textcolor, $font, $Address_1);
imagettftext($im, $fontsize, 0, 821, 508, $textcolor, $font, $Address_2);


imagettftext($im, $fontsize, 0, 101, 570, $textcolor, $font, $City);
imagettftext($im, $fontsize, 0, 835, 570, $textcolor, $font, $State);
imagettftext($im, $fontsize, 0, 1153, 570, $textcolor, $font, $Zip);

imagettftext($im, $fontsize, 0, 231, 632, $textcolor, $font, $Area_Code);
imagettftext($im, $fontsize, 0, 312, 632, $textcolor, $font, $Telephone_Number);

imagettftext($im, $fontsize, 0, 650, 630, $textcolor, $font, $Fax_Area_Code);
imagettftext($im, $fontsize, 0, 740, 630, $textcolor, $font, $Fax_Telephone_Number);

imagettftext($im, $fontsize, 0, 1153, 630, $textcolor, $font, $Applicant_Email);

imagettftext($im, $fontsize, 0, 450, 709, $textcolor, $font, $States_Business);
imagettftext($im, $fontsize, 0, 341, 878, $textcolor, $font, $Year_Company_Started);
imagettftext($im, $fontsize, 0, 805, 878, $textcolor, $font, $Fed_ID);
imagettftext($im, $fontsize, 0, 441, 940, $textcolor, $font, $Products_Sold);
imagettftext($im, $fontsize, 0, 494, 1002, $textcolor, $font, $Average_Sale_Price);
imagettftext($im, $fontsize, 0, 1242, 1002, $textcolor, $font, $Units_Sold);

imagettftext($im, $fontsize, 0, 140, 1470, $textcolor, $font, $Owner_1_Name);
imagettftext($im, $fontsize, 0, 255, 1544, $textcolor, $font, $Owner_1_Home_Address);
imagettftext($im, $fontsize, 0, 957, 1544, $textcolor, $font, $Owner_1_City);
imagettftext($im, $fontsize, 0, 1316, 1544, $textcolor, $font, $Owner_1_State);
imagettftext($im, $fontsize, 0, 1503, 1544, $textcolor, $font, $Owner_1_Zip);
imagettftext($im, $fontsize, 0, 296, 1619, $textcolor, $font, $Owner_1_Social_Security_Number);
imagettftext($im, $fontsize, 0, 1074, 1619, $textcolor, $font, $Owner_1_Home_Phone);
imagettftext($im, $fontsize, 0, 1143, 1470, $textcolor, $font, $Owner_1_Percent_Owned);
imagettftext($im, $fontsize, 0, 1496, 1470, $textcolor, $font, $Owner_1_Years_Owned);

imagettftext($im, $fontsize, 0, 141, 1694, $textcolor, $font, $Owner_2_Name);
imagettftext($im, $fontsize, 0, 257, 1770, $textcolor, $font, $Owner_2_Home_Address);
imagettftext($im, $fontsize, 0, 957, 1770, $textcolor, $font, $Owner_2_City);
imagettftext($im, $fontsize, 0, 1318, 1770, $textcolor, $font, $Owner_2_State);
imagettftext($im, $fontsize, 0, 1505, 1770, $textcolor, $font, $Owner_2_Zip);
imagettftext($im, $fontsize, 0, 299, 1845, $textcolor, $font, $Owner_2_Social_Security_Number);
imagettftext($im, $fontsize, 0, 1076, 1845, $textcolor, $font, $Owner_2_Home_Phone);
imagettftext($im, $fontsize, 0, 1144, 1694, $textcolor, $font, $Owner_2_Percent_Owned);
imagettftext($im, $fontsize, 0, 1496, 1694, $textcolor, $font, $Owner_2_Years_Owned);

imagettftext($im, $fontsize, 0, 142, 1917, $textcolor, $font, $Owner_3_Name);
imagettftext($im, $fontsize, 0, 259, 1995, $textcolor, $font, $Owner_3_Home_Address);
imagettftext($im, $fontsize, 0, 958, 1995, $textcolor, $font, $Owner_3_City);
imagettftext($im, $fontsize, 0, 1317, 1995, $textcolor, $font, $Owner_3_State);
imagettftext($im, $fontsize, 0, 1504, 1995, $textcolor, $font, $Owner_3_Zip);
imagettftext($im, $fontsize, 0, 298, 2069, $textcolor, $font, $Owner_3_Social_Security_Number);
imagettftext($im, $fontsize, 0, 1076, 2069, $textcolor, $font, $Owner_3_Home_Phone);
imagettftext($im, $fontsize, 0, 1144, 1917, $textcolor, $font, $Owner_3_Percent_Owned);
imagettftext($im, $fontsize, 0, 1496, 1917, $textcolor, $font, $Owner_3_Years_Owned);

//If Licensed
if($Licensed_State == "Yes"){
    imagettftext($im, $fontsize, 0, 610, 780, $textcolor, $font, "X");
}
if($Licensed_State == "No"){
    imagettftext($im, $fontsize, 0, 757, 780, $textcolor, $font, "X");
}    

//Business Type

if($Type_of_Business == "Proprietorship"){
    imagettftext($im, $fontsize, 0, 533, 1080, $textcolor, $font, "X");
}
if($Type_of_Business == "Partnership"){
    imagettftext($im, $fontsize, 0, 533, 1115, $textcolor, $font, "X");
}
if($Type_of_Business == "Corporation"){
    imagettftext($im, $fontsize, 0, 832, 1080, $textcolor, $font, "X");
}
if($Type_of_Business == "LLC"){
    imagettftext($im, $fontsize, 0, 832, 1115, $textcolor, $font, "X");
}

//How Heard Options

if($How_Heard == "Direct Mail"){
    imagettftext($im, $fontsize, 0, 484, 1192, $textcolor, $font, "X");
}
if($How_Heard == "Manufacturer Referral"){
    imagettftext($im, $fontsize, 0, 484, 1230, $textcolor, $font, "X");
}
if($How_Heard == "Magazine Ad"){
    imagettftext($im, $fontsize, 0, 484, 1267, $textcolor, $font, "X");
}
if($How_Heard == "Trade Show"){
    imagettftext($im, $fontsize, 0, 746, 1192, $textcolor, $font, "X");
}
if($How_Heard == "BFC Website"){
    imagettftext($im, $fontsize, 0, 946, 1230, $textcolor, $font, "X");
}
if($How_Heard == "Dealer Referral"){
    imagettftext($im, $fontsize, 0, 1344, 1192, $textcolor, $font, "X");
}
if($How_Heard == "Other Website"){
    imagettftext($im, $fontsize, 0, 1248, 1230, $textcolor, $font, "X");
}
if($How_Heard == "Other"){
    imagettftext($im, $fontsize, 0, 1248, 1267, $textcolor, $font, "X");
}

//How Heard Options

imagettftext($im, $fontsize, 0, 940, 1267, $textcolor, $font, $Choice_Magazine_Ad);
imagettftext($im, $fontsize, 0, 1142, 1192, $textcolor, $font, $Choice_Trade_Show);
imagettftext($im, $fontsize, 0, 1404, 1267, $textcolor, $font, $Choice_Other);


//header("Content-type: image/jpeg");
$filename = "$dest_loc/$Company_Name-Pg1.jpg";
$file_ext = "";
$flag_check = false;
while ($flag_check === false){
    if(!($flag_check = checkfile($filename))){
        $file_ext = $file_ext."a";
        $filename = "$dest_loc/$Company_Name-$file_ext-Pg1.jpg";
    }
}

$image_upload = imagejpeg($im, $filename);

imagedestroy($im);

[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.