diff options
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/mail/get.inc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc index e0c4e2911..ae48307e3 100644 --- a/program/steps/mail/get.inc +++ b/program/steps/mail/get.inc @@ -84,17 +84,18 @@ else if ($_GET['_thumb']) { // render thumbnail image if not done yet if (!is_file($cache_file)) { - $fp = fopen(($orig_name = $cache_basename . '.orig.' . $ext), 'w'); - $MESSAGE->get_part_content($part->mime_id, $fp); - fclose($fp); - - $image = new rcube_image($orig_name); - if ($imgtype = $image->resize($thumbnail_size, $cache_file, true)) { - $mimetype = 'image/' . $imgtype; - unlink($orig_name); - } - else { - rename($orig_name, $cache_file); + if ($fp = fopen(($orig_name = $cache_basename . '.orig.' . $ext), 'w')) { + $MESSAGE->get_part_content($part->mime_id, $fp); + fclose($fp); + + $image = new rcube_image($orig_name); + if ($imgtype = $image->resize($thumbnail_size, $cache_file, true)) { + $mimetype = 'image/' . $imgtype; + unlink($orig_name); + } + else { + rename($orig_name, $cache_file); + } } } |