Skip to content

Instantly share code, notes, and snippets.

@N-Porsh
Forked from vbaert/emailimage.php
Last active December 27, 2015 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save N-Porsh/7247597 to your computer and use it in GitHub Desktop.
Save N-Porsh/7247597 to your computer and use it in GitHub Desktop.
PHP: image in email
<?php
if(isset($_GET['uid']) && isset($_GET['mid'])){
$mailid = (int)$_GET['mid'];
$userid = (int)$_GET['uid'];
$db = new mysqli_connect('databaseserver', 'databaseuser', 'databasepassword', 'databasename');
$db->query("INSERT INTO mailreaders (mailid, userid) VALUES ($mailid, $userid)");
$im=imagecreatetruecolor(1,1);
$white=imagecolorallocate($im,255,255,255);
imagefilledrectangle($im,0,0,1,1,$white);
header("content-type: image/jpeg");
imagejpeg($im);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment