include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/admin/db/company_db.inc");
+include_once($path_to_root . "/reporting/includes/tcpdf.php");
//-------------------------------------------------------------------------------------------------
if (isset($_POST['update']) && $_POST['update'] != "")
}
}
- if ($input_error != 1)
- {
+ if ($input_error != 1) {
$result = move_uploaded_file($_FILES['pic']['tmp_name'], $filename);
$_POST['coy_logo'] = clean_file_name($_FILES['pic']['name']);
- if(!$result)
+ if(!$result) {
display_error(_('Error uploading logo file'));
+ $input_error = 1;
+ } else {
+ $msg = check_image_file($filename);
+ if ( $msg) {
+ display_error( $msg);
+ unlink($filename);
+ $input_error = 1;
+ }
+ }
}
}
if (check_value('del_coy_logo'))
$page_security = 'SA_ITEM';
$path_to_root = "../..";
include($path_to_root . "/includes/session.inc");
+include($path_to_root . "/reporting/includes/tcpdf.php");
$js = "";
if ($SysPrefs->use_popup_windows)
{
mkdir($filename);
}
- $filename .= "/".item_img_name($stock_id).".jpg";
+ $filename .= "/".item_img_name($stock_id).(substr(trim($_FILES['pic']['name']), strrpos($_FILES['pic']['name'], '.')));
if ($_FILES['pic']['error'] == UPLOAD_ERR_INI_SIZE) {
display_error(_('The file size is over the maximum allowed.'));
if ($upload_file == 'Yes')
{
$result = move_uploaded_file($_FILES['pic']['tmp_name'], $filename);
+ if ($msg = check_image_file($filename)) {
+ display_error($msg);
+ unlink($filename);
+ $upload_file ='No';
+ }
}
$Ajax->activate('details');
/* EOF Add Image upload for New Item - by Ori */
*/
require_once(dirname(__FILE__)."/html_entity_decode_php4.php");
+//
+// Check image file format against specific TCPDF engine requirements.
+//
+function check_image_file($filename)
+{
+ $test = new TCPDF();
+ if ( !$test->Image($filename, 0, 0) )
+ return _('Unsupported image file format.');
+ return '';
+}
+
if (!class_exists('TCPDF')) {
/**
* define default PDF document producer
}
}
$this->endlinex = $this->img_rb_x;
+ return $info;
}
/**