From 46f7b7096450939fe03c95aa81ce06ae4bfca89d Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 28 Mar 2016 06:51:43 -0400
Subject: [PATCH] Enable reply/reply-all/forward buttons also in preview frame of message/rfc822

---
 program/lib/Roundcube/rcube_image.php |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/program/lib/Roundcube/rcube_image.php b/program/lib/Roundcube/rcube_image.php
index 9c9f08b..78f6e61 100644
--- a/program/lib/Roundcube/rcube_image.php
+++ b/program/lib/Roundcube/rcube_image.php
@@ -1,6 +1,6 @@
 <?php
 
-/*
+/**
  +-----------------------------------------------------------------------+
  | This file is part of the Roundcube Webmail client                     |
  | Copyright (C) 2005-2012, The Roundcube Dev Team                       |
@@ -41,6 +41,11 @@
     );
 
 
+    /**
+     * Class constructor
+     *
+     * @param string $filename Image file name/path
+     */
     function __construct($filename)
     {
         $this->image_file = $filename;
@@ -85,9 +90,9 @@
      * Resize image to a given size. Use only to shrink an image.
      * If an image is smaller than specified size it will be not resized.
      *
-     * @param int    $size      Max width/height size
-     * @param string $filename  Output filename
-     * @param boolean $browser_compat  Convert to image type displayable by any browser
+     * @param int     $size           Max width/height size
+     * @param string  $filename       Output filename
+     * @param boolean $browser_compat Convert to image type displayable by any browser
      *
      * @return mixed Output type on success, False on failure
      */
@@ -227,6 +232,10 @@
                 $height    = intval($props['height'] * $scale);
                 $new_image = imagecreatetruecolor($width, $height);
 
+                if ($new_image === false) {
+                    return false;
+                }
+
                 // Fix transparency of gif/png image
                 if ($props['gd_type'] != IMAGETYPE_JPEG) {
                     imagealphablending($new_image, false);
@@ -280,9 +289,9 @@
     /**
      * Convert image to a given type
      *
-     * @param int    $type      Destination file type (see class constants)
-     * @param string $filename  Output filename (if empty, original file will be used
-     *                          and filename extension will be modified)
+     * @param int    $type     Destination file type (see class constants)
+     * @param string $filename Output filename (if empty, original file will be used
+     *                         and filename extension will be modified)
      *
      * @return bool True on success, False on failure
      */

--
Gitblit v1.9.1