2016-06-29 8 views
0

を提出し、私は、フォームが入力タイプによって提出されたクライアントメールに画像のdivを送るコンタクトフォーム送信画像のURLは

<form name="form" method="post" action="mail.php" id="myForm"> 
</form> 

を持っている電子メールを送信するための

<input name="submit" type="submit" value="Submit" id="capture" /> 

私のPHPを提出

<?php 
include("auth.php"); 
//message 
$message = $_POST['msg']; 
$username =$_REQUEST['username']; 
$surname =$_REQUEST['surname']; 
$name= $_REQUEST['name']; 
$filename = md5(uniqid(rand(), true)); 
$imageurl = 'http://panosmoustis.netai.net/barcodeimage/'.$filename.'.png'; 
//mail body - image position, background, font color, font size... 

$body = "Dear $surname $name 
Thank you for your Pre-registration for Global. 
Please print the attached e-ticket with your personal barcode and bring it to the reception of the exhibition. 
This barcode includes data about you which is required during registration. Having this barcode will considerably speed up the registration process 
Organizing committee.\n". 



$body = "Print e-ticket 
       $imageurl.\n". 





//to send HTML mail, the Content-type header must be set: 
$headers='MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html;charset=iso-8859-1' . "\r\n"; 
$headers .= 'From: <http://panosmoustis.netai.net/>' . "\r\n"; 
$to = $_POST['mail']; 
$subject = "EXPRESS REGISTRATION (Global)"; 
//mail function 
$email = mail($to, $subject, $body, $headers); 
if(!$email) { 
echo "Error sending email"; 
} else { 
echo "Your email was sent successfully."; 
} 
?> 

は、私は、サーバー上で動的に作成したイメージを保存するためのAjaxの機能を持たれ

<script> 
$("#capture").click(function() { 
html2canvas([document.getElementById('printableArea')], { 
    onrendered: function (canvas) { 
     var imagedata = canvas.toDataURL('image/png'); 
     var imgdata = imagedata.replace(/^data:image\/(png|jpg);base64,/, ""); 
     //ajax call to save image inside folder 
     $.ajax({ 
      url: 'save_image.php', 
      data: { 
        imgdata:imgdata 
        }, 
      type: 'post', 
      success: function (response) { 
       console.log(response); 
       $('#image_id img').attr('src', response); 
      } 
     }); 
    } 
}) 
}); 
</script> 

サーバーに画像を保存するための私のPHPファイル

<?php 
$imagedata = base64_decode($_POST['imgdata']); 
$filename = md5(uniqid(rand(), true)); 
//path where you want to upload image 
$file = '/home/a7784524/public_html/barcodeimage/'.$filename.'.png'; 
$imageurl = 'http://panosmoustis.netai.net/barcodeimage/'.$filename.'.png'; 
file_put_contents($file,$imagedata); 
echo $imageurl; 

私の問題は、私は がここ

答えて

0
$imageurl = 'http://panosmoustis.netai.net/barcodeimage/'.$filename.'.png' 

あなたをありがとう提出フォーム上のクライアントを電子メールで送信するIMAGEURLを送りたいということです使用された文字列連結。ここ

しかし、あなたはしませんでした:

$body = "Print e-ticket $imageurl.\n". 

を使用すると、ランダムなファイル名での$ IMAGEURLを作成したときは、ちょうどあなたがやったと同じことを行う必要があります:)

+0

私はすでにそれを行うためにテスト画像にクライアント情報が含まれているため間違った画像URLが返される – moustispanos

+0

エラーを通知し、エラーが発生した場合は教えてください。 –