1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
|
$file_vg = 'attachments/attachment-'.$attachmentid.'.'.$attachment_file_extension;
list($width, $height, $type) = @getimagesize($file_vg);
if($width > $picmaxwidth || $height > $picmaxheight) {
if(in_array($attachment_file_extension, array('gif', 'jpg', 'jpeg', 'png'))) {
$thumbnail_type = '';
$thumbnail = makeThumbnailImage('attachments/attachment-'.$attachmentid.'.'.$attachment_file_extension, $thumbnail_type, $picmaxwidth, $picmaxheight);
// save Bild
if ($thumbnail != '' && $thumbnail_type != '') {
@unlink("attachments/attachment-".$attachmentid.".".$attachment_file_extension);
$fp = fopen('attachments/attachment-'.$attachmentid.'.'.$thumbnail_type, 'wb');
fwrite($fp, $thumbnail);
fclose($fp);
@chmod('attachments/attachment-'.$attachmentid.'.'.$thumbnail_type, 0777);
$db->unbuffered_query("UPDATE bb".$n."_attachments SET attachmentextension='".addslashes($thumbnail_type)."', attachmentsize='".wbb_strlen($thumbnail)."' WHERE attachmentid='$attachmentid'", 1);
}
}
}
|