restrict vendor image size

  • Posts: 108
  • Thank you received: 6
10 years 1 month ago #175568

-- HikaShop version -- : 2.3.3
-- HikaMarket version -- : 1.4.4
-- Joomla version -- : 3.3.3

Hi,

I am looking to be able to restrict the image size for the vendor. I am able to control its appearance size, but would like to be able to restrict the image size in KB, so a user doesnt upload large image files and start to fill up the server space unnecessarily.

when I set the image width & height, and force size (in configuration), does this resize the incoming image to that size on the server? or does it create a "thumbnail" of that size?

if not, is there a way of controlling this?

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
10 years 1 month ago #175587

Hi,

We do not have an option (yet) for that but you can already set that limitation in HikaMarket.
For the moment you need to edit the file "components/com_hikamarket/controllers/product.php" and replace

if($vendor_id > 1)
	$options['sub_folder'] = 'vendor'.$vendor_id.DS;
By
if($vendor_id > 1) {
	$options['sub_folder'] = 'vendor'.$vendor_id.DS;
	$options['max_file_size'] = 400*1024; // 400K
}
in order to set the max file size that the vendor have the right to upload in the front-end.
About the parameters for the image, the HikaShop image configuration is used for that, so if you put a restriction for your vendors, it will restrict your uploads in the backend too.

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: 108
  • Thank you received: 6
10 years 1 month ago #175590

brilliant i'll try that now.

can you tell me if this will also apply to custom fields - in particular the ajax image field?

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
10 years 1 month ago #175592

Hi,

The ajax image field for what kind of custom field ?
The patch I gave you is targeting product images and product files.

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: 108
  • Thank you received: 6
10 years 1 month ago #175721

its actually for a vendor field

I have a vendor adding another image as a custom background for their page. I would love to restrict them to uploading an image by pixel size (e.g. 900px x 250px) but would accept being able to limit it by file size

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
10 years 1 month ago #175736

Hi,

The custom fields are not managed by HikaMarket but by HikaShop itself.
It uses the HikaShop upload system and the controller "order" which made all checks for all custom fields.
Because HikaMarket is using the HikaShop custom field system, it does not have the control of the upload.
So it's something to change into HikaShop.

The idea I got was to extend the "ajax file" and "ajax image" in order to add new options.
These options could then be loaded in the controller and set to the upload setting data.
You can open the file "components/com_hikashop/controllers/order.php" and check the function "getUploadSetting".
You will see that the custom field is loaded and his settings are checked.
You can add your "max_file_size" option depending the name of the custom field ; in order to wait for the improvement for the "ajax file/image" configuration.

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.

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