[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Небольшая помощь новичку
Гость_Алексей
Доброго времени суток.
Сам в PHP новичок, при написание кода возникла небольшая проблема.


<?
if(isset($_POST["go"])) {


switch($_POST['konkurs'])
{
case 1: $pic="3.jpg";
case 2: $pic="2.jpg";
case 3: $pic="3.jpg";
case 4: $pic="3.jpg";
case 5: $pic="3.jpg";
case 6: $pic="3.jpg";
case 7: $pic="3.jpg";
case 8: $pic="3.jpg";
case 9: $pic="3.jpg";
case 10: $pic="3.jpg";
case 11: $pic="3.jpg";
case 12: $pic="3.jpg";
case 13: $pic="3.jpg";
case 14: $pic="3.jpg";
case 15: $pic="3.jpg";
case 16: $pic="3.jpg";
case 17: $pic="3.jpg";
case 18: $pic="3.jpg";
case 19: $pic="3.jpg";
case 20: $pic="3.jpg";
case 21: $pic="3.jpg";
case 22: $pic="3.jpg";
case 23: $pic="3.jpg";
case 24: $pic="3.jpg";
case 25: $pic="3.jpg";
case 26: $pic="3.jpg";
case 27: $pic="3.jpg";

default: $pic="3.jpg";

}


//$pic="3.jpg";

$pic = ImageCreateFromjpeg($pic);
$color=ImageColorAllocate($pic, 250, 0, 0);

function win_uni ($in) {
// $in = convert_cyr_string($in ,"w","i");
//$in = iconv("windows-1251", "iso8859-5",$in);

$in = iconv("UTF-8", "iso8859-5",$in);
//echo $in."<br>";
$out = "";
for ($i=0; $i < strlen($in); $i++) {
$char = ord($in[$i]);
//echo $in[$i]." - ".$char."<br>";
if ($char==240) {$out .= "N"; continue;}
$out .= ($char > 175)?"&#".(1040+($char-176)).";":$in[$i]; }
return $out;
}



$k1=13.0;
$k2=10;
$k3=11.2;

//echo iconv_strlen($_POST['kurator'],"UTF-8");

$_POST['name'] = htmlspecialchars(stripslashes($_POST['name']));
$_POST['klass'] = stripslashes($_POST['name1']);
$_POST['shkola'] = htmlspecialchars(stripslashes($_POST['name2']));
$_POST['gorod'] = htmlspecialchars(stripslashes($_POST['name3']));
$_POST['kurator'] = htmlspecialchars(stripslashes($_POST['name4']));
$_POST['nomer'] = htmlspecialchars(stripslashes($_POST['name5']));

// Тут прописываю координаты вставки текста



Imagejpeg($pic,"sert.jpg");
ImageDestroy($pic);


function sendMail($to, $thm, $html, $path)
{
$fp = fopen($path,"r");
if (!$fp)
{
print "Не могу открыть файл";
exit();
}
$file = fread($fp, filesize($path));
fclose($fp);


$boundary = "--".md5(uniqid(time()));
$message_part2="";

if (!empty($_FILES['rabota']['tmp_name']))

{

// Закачиваем файл

$path2 = $_FILES['rabota']['name'];

if (copy($_FILES['rabota']['tmp_name'], "temp/".$path2)) $picture = "temp/".$path2;

$fp2 = fopen($picture,"r");
if (!$fp2)
{
print "Не могу открыть файл2";
exit();
}
$file2 = fread($fp2, filesize($picture));
fclose($fp2);

$message_part2 = "--$boundary\n";
$message_part2 .= "Content-Type: application/octet-stream; name=".basename($path2)."\n";
$message_part2 .= "Content-Transfer-Encoding: base64\n";
$message_part2 .= "Content-Disposition: attachment; filename = \"".$path2."\"\n\n";
$message_part2 .= chunk_split(base64_encode($file2))."\n";


}




// echo "$boundary";
$headers="From: Новый документ <wow@example.com>\n";
$headers.= "Mime-Version: 1.0\n";
$headers .="Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
$multipart = "--$boundary\n";
$kod = 'koi8-r';
$multipart .= "Content-Type: text/plain; charset=$kod\nFrom: ЗНАЧЕНИЕ";
$multipart .= "Content-Transfer-Encoding: Quot-Printed\n\n";
$multipart .= "$html\n\n";

$message_part = "--$boundary\n";
//$message_part .= "Content-Type: application/octet-stream\n";
$message_part .= "Content-Type: image/jpeg; name=sertificat.jpg\n";
$message_part .= "Content-Transfer-Encoding: base64\n";
$message_part .= "Content-Disposition: attachment; filename = \"".$path."\"\n\n";
$message_part .= chunk_split(base64_encode($file))."\n";


$multipart .= $message_part.$message_part2."--$boundary--\n";



if(!mail($to, $thm, $multipart, $headers))
{
echo "Ошибка с почтой";
exit();
}
else
{
//echo 'ok';
?>



Это кусочек кода наложения текста на картинку. Самое начало. То есть под определенное значение мне нужна своя картинка подскажите как правельно прописать значение переменной $pic, чтобы под каждое значение (case 1,2....n) подставлялось своя картинка
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.