Uploaded images increase size drastically

  • Posts: 228
  • Thank you received: 8
9 years 2 months ago #188104

-- url of the page with the problem -- : fitin.guywalderonline.com/index.php
-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6

Hi,

I've noticed a very weird issue/feature. I'm using Photoshop to decrees the size (weight in kb) of my images so they'll be optimized for web. I've noticed that when I upload images to product via Hikashop the size of the images is doubled. Tried to upload a 260kb image and it was increases to 600kb on the server. This goes for many other images as well. I've tried this with jpg files.

Any idea why is this happening? Is this a feature of some sort or maybe a bug?

Thank you in advance,

Guy.

Last edit: 9 years 2 months ago by theguy.

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

  • Posts: 2143
  • Thank you received: 747
9 years 2 months ago #188151

Hi,

Here's a thread from my earlier days with HikaShop after I had discovered the same symptoms you're reporting here: www.hikashop.com/forum/product-category-...mage-size-in-kb.html

It's a long read, but I hope it helps you understanding the mystery, too.


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
9 years 2 months ago #188106

Hi,

Depending your HikaShop configuration for the images, when you upload an image which will be bigger than the image restriction, or if you are using watermarking ; HikaShop will reprocess the image using PHP-GD.
This image library allow HikaShop to resize the image but, this library is not Photoshop and does not have all of these optimization processes.
So I will recommend you to check your HikaShop configuration for images so HikaShop won't require to reprocess the uploaded images.

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: 228
  • Thank you received: 8
9 years 2 months ago #188166

Hello Jerome and lousyfool,

Thank you both for your replies.

As for my image setting in Hikashop, I've setup the image size for 1290X860 px and I'm uploading images at the exact same size. I'm not using watermark or any other info that might add size to my images. There's no apparent reason for my images to be processed. It seems that the origin of this issue is indeed with PHP-GD just as lousyfool experienced before. In my case I do have hundreds of product images varying at 150-200 kb each. Having a 200 kb image blowing up to 600 kb, add to that the additional thumbnails, that's over 1 mb per image. That's CRAZY!!! If we set aside the huge storage amount spent for nothing, the loading times increase for no reason as well.

I've tried to change the setting of the compression in image.php from 95 to 10 with no effect.

lousyfool, did you eventually solve this issue? Read the entire post but there's no apparent solution. Is there a way to completely disable the PHP-GD compression?

Jerome, this is my third project in which I've used Hikashop. I really like your product and I usually use the Essential version. I would like to keep on using it but this is a deal breaker in my book. Please, let there be a solution for this... :S

Thank you both in advance,

Guy.

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
9 years 2 months ago #188185

Hi,

Is there a way to completely disable the PHP-GD compression?

Like I told you, you need to change your configuration in order to not reprocess the image.
You can't tweak how PHP-GD optimize the image compression ; you can use a lower ratio in the compression to have lower size images but you will also loose quality.. And that's not what you want.

So, like I wrote you in my previous message:

So I will recommend you to check your HikaShop configuration for images so HikaShop won't require to reprocess the uploaded images.

Please change the image restriction to something a little bit bigger, like "1295x865".
Otherwise you can modify the HikaShop helper image to not resize the image if the restriction size is the same.
File : administrator/components/com_hikashop/helpers/image.php
	function scaleImage($x, $y, $cx, $cy, $scaleMode = 'inside') {
		if(empty($cx)) $cx = 9999;
		if(empty($cy)) $cy = 9999;

		if ($x >= $cx || $y >= $cy) {
Into
	function scaleImage($x, $y, $cx, $cy, $scaleMode = 'inside') {
		if(empty($cx)) $cx = 9999;
		if(empty($cy)) $cy = 9999;

		if ($x > $cx || $y > $cy) {
It is something I will commit in HikaShop for the future release.

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: 2143
  • Thank you received: 747
9 years 2 months ago #188197

@theguy:

As both Jerome here and Nicolas over in the other thread as well as other sources across the web are saying, we can't expect PHP GD doing a similarly good job as Photoshop when using "Save for web..." there. So, it's really more down to setting the image sizes in HikaShop's configuration wisely, especially for thumbnails and product page.

theguy wrote: ... this is a deal breaker in my book.

Hmm, PHP GD is a very popular library, practically on every server, and hence, used by probably everyone else, too. So, it's very likely - if not even almost guaranteed - that you'll end up with the use of GD in other e-commerce packages as well. Hard to "run away"from it, I'd say...

theguy wrote: I've tried to change the setting of the compression in image.php from 95 to 10 with no effect.

I experienced the same on a local (MAMP Pro) server, still haven't had opportunity to monitor/verify on my "live" server. Make sure that the GD library is properly installed on your server, possibly check with your host.
And maybe the HikaShop guys can quickly verify that higher GD compression works for them...?


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
Last edit: 9 years 2 months ago by lousyfool.

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

  • Posts: 228
  • Thank you received: 8
9 years 2 months ago #188295

Hi,

lousyfool, I have no illusions that the PHP-GD will do a good work as Photoshop does. Just not such a crappy job. I was not aware that it is so commonly used though.

Jerome, I've tried changing the Image width and height under System -> Configuration -> Main -> Images to 865 by 1295 px but it made no difference. My situation right now is like so:
Uploaded a 200kb image. Got the following files generated on my server:
1. Under media/com_hikashop/upload - 507kb
2. Under media/com_hikashop/upload/thumbnails/1290x860 - 281kb
3. Under media/com_hikashop/upload/thumbnails/370x250fsO - 40kb
4. Under media/com_hikashop/upload/thumbnails/600x430 - 88kb
5. Under media/com_hikashop/upload/thumbnails/100x100fsO - 8kb
6. Under media/com_hikashop/upload/thumbnails/150x100 - 8kb

That's allot of storage of one image. There must be something I'm missing or that can be done to reduce this sizes. I would like to at least reduce the sizes of the first two. My site has less then 150 products and it's already 200MB of storage while the core is only 60MB. I got hundreds more to upload...

Any other ideas please?

Thank you both again for helping.

Guy.

Last edit: 9 years 2 months ago by theguy.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 2 months ago #188306

Hi,

What can be done is to set a fixed setting in the Configuration > Main > Images, then check the used folder and upload all the images via ftp with the correct naming.
You can use softwares like xnconvert to process a lot of images at one time, this way you are sure that the sizes will not be changed.

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

  • Posts: 228
  • Thank you received: 8
9 years 2 months ago #188424

Xavier wrote: Hi,

What can be done is to set a fixed setting in the Configuration > Main > Images, then check the used folder and upload all the images via ftp with the correct naming.
You can use softwares like xnconvert to process a lot of images at one time, this way you are sure that the sizes will not be changed.

So basically you're telling me that this issue cannot be resolved and it's up to me to manually optimize my images and upload them back to the server. That is a very weird solution but I guess I don't have much options do I?!

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
9 years 2 months ago #188426

Hi,

Please remove the image size restriction. So the first image you will upload wouldn't be reprocessed.
For the thumbnail, the best will be to decrease the image quality, so the image will be liter.

But regarding the folder

Under media/com_hikashop/upload/thumbnails/1290x860

I think it is strange because it means that the image is not "1290x860" originally. Specially if the image is 500Ko in the main upload folder and then ~200ko in the thumbnail one.
Are you sure that your image is 1290x860 pixels ?

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: 228
  • Thank you received: 8
9 years 2 months ago #188495

Hi Jerome,

Completely removing the image size restriction did the trick :lol: :lol: :lol:
Now the file size under media/com_hikashop/upload is 204kb.
Under media/com_hikashop/upload/thumbnails/1290x860 it was 280kb.
I can live with that.

Thank you, Xavier and lousyfool for helping with this.

I would check into the inflation of images under the root upload folder. Correct me if I'm wrong but this files do not get processed by the PHP-GD right?

I've attached my image so you can make your test with it.

Thank you all very much, again.

Guy.

Attachments:
Last edit: 9 years 2 months ago by theguy.

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

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
9 years 2 months ago #188532

Hi,

It's normal. If you set the image width/height settings the main image in the root folder will be processed by PHP-GD when you upload it and thus the size will increase compared to your original image as PHP-GD isn't as optimized as photoshop for the compression of the images.

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

Time to create page: 0.102 seconds
Powered by Kunena Forum