Mam nadzieję iż temat wylądował w dobrym dziale i jakoś pomożecie.
<?php // link to the font file no the server $fontname = 'font/Verdana.ttf'; // controls the spacing between text $i=30; //JPG image quality 0-100 $quality = 90; function create_image($user){ // if the file already exists dont create it again just serve up the original //if (!file_exists($file)) { // define the base image that we lay our text on $im = imagecreatefromjpeg("pass.jpg"); // setup the text colours $color['grey'] = imagecolorallocate($im, 54, 56, 60); $color['green'] = imagecolorallocate($im, 55, 189, 102); // this defines the starting height for the text block $y = imagesy($im) - $height - 500; // loop through the array and write the text foreach ($user as $value){ // center the text in our image - returns the x value $x = center_text($value['name'], $value['font-size']); imagettftext($im, $value['font-size'], 0, $x, $y+$i, $color[$value['color']], $fontname,$value['name']); // add 32px to the line height for the next text block $i = $i+25; } // create the image imagejpeg($im, $file, $quality); //} return $file; } function center_text($string, $font_size){ $image_width = 800; $dimensions = imagettfbbox($font_size, 0, $fontname, $string); } 'name'=> 'Tutuł aukcji', 'font-size'=>'27', 'color'=>'grey'), 'name'=> 'Treść aukcji - wiersz 1', 'font-size'=>'11', 'color'=>'grey'), 'name'=> 'Treść aukcji - wiersz 2', 'font-size'=>'11', 'color'=>'grey' ) ); $error[] = 'Uzupełnij Tytuł'; } $error[] = 'Uzupełnij wiersz'; } $error[] = 'Uzupełnij wiersz'; } 'name'=> $_POST['name'], 'font-size'=>'27', 'color'=>'grey'), 'name'=> $_POST['job'], 'font-size'=>'16', 'color'=>'grey'), 'name'=> $_POST['email'], 'font-size'=>'13', 'color'=>'green' ) ); } } // run the script to create the image $filename = create_image($user); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> <link href="../style.css" rel="stylesheet" type="text/css" /> <style> input{ border:1px solid #ccc; padding:8px; font-size:14px; width:300px; } .submit{ width:110px; background-color:#FF6; padding:3px; border:1px solid #FC0; margin-top:20px;} </style> </head> <body> <?php include '../includes/header.php'; $link = '| <a href="http://papermashup.com/dynamically-add-form-inputs-and-submit-using-jquery/">Back To Tutorial</a>'; ?> <ul> foreach($error as $errors){ } }?> </ul> <p>Edytor aukcji</p> <div class="dynamic-form"> <form action="" method="post"> <label>Tytuł aukcji</label> <label>Wiersz 1</label> <label>Wiersz 2</label> <input name="submit" type="submit" class="btn btn-primary" value="Wygeneruj aukcje" /> </form> </div> <?php include '../includes/footer.php';?> </body> </html>
Pomoże ktoś? Bardzo mi to potrzebne.