added garbage collection to viewed images

This commit is contained in:
SJ
2014-02-24 10:10:28 +01:00
parent 190ce71af7
commit 81b6f2357d
3 changed files with 5 additions and 3 deletions

View File

@ -81,13 +81,13 @@ class ControllerMessageView extends Controller {
foreach($this->data['attachments'] as $a) {
if(preg_match("/image/", $a['type'])) {
$attachment = $this->model_search_message->get_attachment_by_id($a['id']);
$fp = fopen(DIR_BASE . 'tmp/' . $a['id'], "w+");
$fp = fopen(DIR_BASE . 'tmp/' . "i." . $a['id'], "w+");
if($fp) {
fwrite($fp, $attachment['attachment']);
fclose($fp);
$this->data['images'][] = array(
'name' => $a['id']
'name' => "i." . $a['id']
);
}
}