Vendor can upload huge product images (58 MB)

  • Posts: 126
  • Thank you received: 2
9 years 6 months ago #205290

-- HikaShop version -- : 2.4.0
-- HikaMarket version -- : 1.6.2
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.6
-- Browser(s) name and version -- : Chrome 43

Hello,

Please tell me how can i limit the size of the uploaded file for the main image(s), i found that as a vendor i can upload a product image over 50 MB. For example, i uploaded a 58 MB tif image as main image, and at the end after one minute, i get the message that my webserver cannot render the picture.

I need to allow users to upload only of certain size for the product image (1-2 MB) (not files, the files for download can have even 100 MB, the max limit of my webserver), how can i do this?

Thank you

Last edit: 9 years 6 months ago by mett.

Please Log in or Create an account to join the conversation.

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
9 years 6 months ago #205299

Hi,

There is no option for the moment to limit the image file size ; but there is an option to limit the image dimension (width/height).
www.hikashop.com/support/documentation/1...l#config_main_editor

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 126
  • Thank you received: 2
9 years 6 months ago #205372

I've already set the image dimensions, but this doesn't stop the vendors to upload large files. It's not helpful for them (the image cannot be rendered) and for me also, i'll waste a lot of bandwidth allocated for nothing.

Please add this feature for the next release of HikaMarket.

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
9 years 6 months ago #205413

Hi,

So at this moment I'll suggest use to use the "maxSize" option of the javascript upload library.
First, you will have to edit the file "administrator/components/com_hikashop/types/uploader.php" and replace

		$options['maxSize'] = min(hikashop_bytes(ini_get('upload_max_filesize')), hikashop_bytes(ini_get('post_max_size')));
By
		$maxSize = min(hikashop_bytes(ini_get('upload_max_filesize')), hikashop_bytes(ini_get('post_max_size')));
		if(empty($options['maxSize'])) {
			$options['maxSize'] = $maxSize;
		} else {
			$size = (int)$options['maxSize'];
			if((''.$size) != $options['maxSize'])
				$size = hikashop_bytes($options['maxSize']);
			$options['maxSize'] = min($size, $maxSize);
		}

And then, in the view "productmarket | form_image", you can replace
	'ajax' => $ajax
);
By
	'ajax' => $ajax,
	'maxSize' => '2M'
);

It should give to the javascript library a size limitation for the image upload of 2MB (instead of reading the maximum upload size that your server can accept).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: mett

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.064 seconds
Powered by Kunena Forum