PDA

View Full Version : Mod: Thumb in notification email


raminia
02-28-2005, 09:28 PM
Ok... I gave up submitting paper for tonight and meeting the deadline. Thus, I'll post the first orginal thread of this category;)

-------------------------------
I've modifided the notification email for myself to send HTML email instead of Plain Text and this let me send thumbnail of the commented image along with the comment note.

It works 100% for me right now and I'm using yahoo account for photoblog email notifications. But it came with no warranty 'cause it's not tested by many users.

To have it you should do some modification in index.php and add a line to image_template.html

0) Replace from where says
// EMAIL NOTE ON COMMENTS
to } // commentemail yes

(at about lines 519-551) with this
// ################################################## ########################################//
// EMAIL NOTE ON COMMENTS
// ################################################## ########################################//
if($cfgrow['commentemail'] == "yes") {
if($_GET['x'] == "save_comment") {



$admin_email = $cfgrow['email'];
$comment_name = clean($_POST['name']);
$comment_image_id = $_POST['parent_id'];
$comment_message = clean($_POST['message']);

// Ramin added
$comment_image_name = $_POST['parent_name'];
$link_to_comment = $cfgrow['siteurl']."?showimage=$comment_image_id";
$link_to_img_thumb_cmmnt = "Thumbnail Link:" .$cfgrow['siteurl'] ."thumbnails/thumb_$comment_image_name";
$img_thumb_cmmnt = "<img src='" .$cfgrow['siteurl'] ."thumbnails/thumb_$comment_image_name' >";


$subject = "Pixelpost - New Comment Made";
$sent_date = date("Y-m-d");
$sent_time = date("H:i");
$body = "Hello,<br>
A new comment has been made at your photoblog.<br><br>
<a href='$link_to_comment'>$link_to_comment</a><br>
$img_thumb_cmmnt<br>
<br>
The Comment is: <br>
----------------------------------------------------------------------<br>
$comment_message<br>
by $comment_name<br>
---------------------------------------------------------------------- <br>
Email Sent by pixelpost<br>
";
// Ramin added and modified
$headers = "Content-Type: text/html; charset=ISO-8859-1\r\n" ;
$headers .= "From: PIXELPOST <$admin_email>\r\n";

$recipient_email = "admin" ."<$admin_email>";
mail($recipient_email,$subject,$body,$headers);
}
} // commentemail yes


1) add line

$parent_name = $_POST['parent_name'];
in the section:
// build a string with all comments

that become like this (at about line 247)

// build a string with all comments
if(($_GET['x'] == "") or ($_GET['popup'] == "comment")) {
if($_GET['comment'] == "save") {
$datetime = date("Y-m-d H:i:s");
$ip = $_SERVER['REMOTE_ADDR'];
$parent_id = $_POST['parent_id'];
// Ramin added
$parent_name = $_POST['parent_name'];

3) add the line
<input type='hidden' name='parent_name' value='<IMAGE_NAME>' /> in the commenting form in the template (image_template.html)below the line reads
<input class='input' type='text' name='email' value='<VINFO_EMAIL>'/><p />

Please check if this modification is compatible with text only emails. I'm not sure that if you use a text only email (not web based or POP3), results of this modifcation would satisfy you. POP3 and web-based are compatible with this modificaiton.