As for ascii -php post images
How to post ascii image in php? Used the link https://github.com/idevelop/ascii-camera to create ascii image from camera. When I post it, it doesn't show an image, but it does display ascii characters. I tried text contenttype / plain charset ascii and text / html but didn't get the photo in the email. Can anyone help me. Thank you.
Inserting php code below
<?php
$headers = 'From: webmaster@test.com' . "\r\n" .
'Reply-To: webmaster@test.com' . "\r\n" .
'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$to='testmail@test.com';
$subject='from camera with image mod';
$message=$_POST["msgbody"];
mail($to, $subject, $message, $headers);
?>
+3
source to share
1 answer
You must use a monospaced font for the image to be displayed on email. Otherwise it will be a mess, bec. the character width is different if the font is not a fixed width.
Try this as body text:
$body = "
<html>
<body>
<pre style='font: monospace'>".$_POST["msgbody"]."</pre>
</body>
</html>";
The content type must be Content-type: text/html;
.
!Direct use (without disinfection) of user-entered data is highly insecure .
+1
source to share