function resize($type = 'width') { self::getSizes(); $sizes = self::getThumbSizes($type); self::$output_type = strtolower(substr(self::getMime(), strpos(self::getMime(), '/') + 1)); $icfunc = "imagecreatefrom" . self::$output_type; $new_img = @$icfunc(self::$original); self::$dest = imagecreatetruecolor($sizes['width'], $sizes['height']); imagecopyresampled(self::$dest, $new_img, 0, 0, 0, 0, $sizes['width'], $sizes['height'], self::getWidth(), self::getHeight()); self::getThumb(); self::destroy(); }