Changeset 1005 for trunk/expressoMail1_2/inc/class.imap_functions.inc.php
- Timestamp:
- 06/18/09 09:24:17 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r1000 r1005 1052 1052 if (($file_type == 'image/jpeg') || ($file_type == 'image/pjpeg') || ($file_type == 'image/gif') || ($file_type == 'image/png')) { 1053 1053 $img = "<IMG id='".$msg_folder.";;".$msg_number.";;".$i.";;".$msg->pid[$msg_number][$index].";;".$msg->encoding[$msg_number][$index]."' style='border:2px solid #fde7bc;padding:5px' title='".$this->functions->getLang("Click here do view (+)")."'src=./inc/show_thumbs.php?file_type=".$file_type."&msg_num=".$msg_number."&msg_folder=".$msg_folder."&msg_part=".$msg->pid[$msg_number][$index].">"; 1054 $href = "<a onMouseDown='save_image(event,this )' href='#".$msg_folder.";;".$msg_number.";;".$i.";;".$msg->pid[$msg_number][$index].";;".$msg->encoding[$msg_number][$index]."' onClick=\"window.open('./inc/show_img.php?msg_num=".$msg_number."&msg_folder=".$msg_folder."&msg_part=".$msg->pid[$msg_number][$index]."','mywindow','width=700,height=600,scrollbars=yes');\">". $img ."</a>";1054 $href = "<a onMouseDown='save_image(event,this,\"".$file_type."\")' href='#".$msg_folder.";;".$msg_number.";;".$i.";;".$msg->pid[$msg_number][$index].";;".$msg->encoding[$msg_number][$index]."' onClick=\"window.open('./inc/show_img.php?msg_num=".$msg_number."&msg_folder=".$msg_folder."&msg_part=".$msg->pid[$msg_number][$index]."','mywindow','width=700,height=600,scrollbars=yes');\">". $img ."</a>"; 1055 1055 $thumbs_array[] = $href; 1056 1056 } … … 2032 2032 2033 2033 // Build Uploading Attachments!!! 2034 if (count($attachments)) 2035 foreach ($attachments as $attach) 2036 $mail->AddAttachment($attach['tmp_name'], $attach['name'], "base64", $this->get_file_type($attach['name'])); // optional name 2034 $sizeof_attachments = count($attachments); 2035 if ($sizeof_attachments) 2036 foreach ($attachments as $numb => $attach){ 2037 if ($numb == ($sizeof_attachments-1) && $params['insertImg'] == 'true'){ // Auto-resize image 2038 list($width, $height,$image_type) = getimagesize($attach['tmp_name']); 2039 switch ($image_type) 2040 { 2041 case 1: $image_big = imagecreatefromgif($attach['tmp_name']); break; 2042 case 2: $image_big = imagecreatefromjpeg($attach['tmp_name']); break; 2043 case 3: $image_big = imagecreatefrompng($attach['tmp_name']); break; 2044 case 6: 2045 include_once("gd_functions.php"); 2046 $image_big = imagecreatefrombmp($attach['tmp_name']); break; 2047 default: 2048 $mail->AddAttachment($attach['tmp_name'], $attach['name'], "base64", $this->get_file_type($attach['name'])); 2049 break; 2050 } 2051 header('Content-type: image/jpeg'); 2052 $max_resolution = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['image_size']; 2053 $max_resolution = ($max_resolution==""?'65536':$max_resolution); 2054 if ($width < $max_resolution && $height < $max_resolution){ 2055 $new_width = $width; 2056 $new_height = $height; 2057 } 2058 else if ($width > $max_resolution){ 2059 $new_width = $max_resolution; 2060 $new_height = $height*($new_width/$width); 2061 } 2062 else { 2063 $new_height = $max_resolution; 2064 $new_width = $width*($new_height/$height); 2065 } 2066 $image_new = imagecreatetruecolor($new_width, $new_height); 2067 imagecopyresampled($image_new, $image_big, 0, 0, 0, 0, $new_width, $new_height, $width, $height); 2068 $tmpDir = ini_get("session.save_path"); 2069 $_file = "cid_image_".base_convert(microtime(), 10, 36).".dat"; 2070 imagejpeg($image_new,$tmpDir.$_file, 85); 2071 $mail->AddAttachment($tmpDir.$_file, $attach['name'], "base64", $this->get_file_type($tmpDir.$_file)); 2072 } 2073 else 2074 $mail->AddAttachment($attach['tmp_name'], $attach['name'], "base64", $this->get_file_type($attach['name'])); 2075 // optional name 2076 } 2077 2037 2078 2038 2079
Note: See TracChangeset
for help on using the changeset viewer.