Jump to content

Image Resizing


Guest CTI

Recommended Posts

So I have spent the last few days making images of the products and suddenly the upload FCKeditor has decided to not resize the images as I upload them. Actually, it only wants to resize certain jpgs. My images are native 2000x2000 jpg at 72dpi and 280-400KB. Previously the upload manager would crunch them to the 390x390 at 19-21KB. Loved it! But now, I have to add an extra step in photoshop to resize the images then upload them. Very strange. Am I doing something stupid? Any advice would be great. Thanks.

BTW, I have not clicked the "Dont Resize image" button

Link to comment
Share on other sites

Hi CTI,

If you consider that the server needs to unpack the JPG, it will require a large amount of memory. A 2000x2000 image at 24bit colour will require 12,000,000 bytes (~11.5MB), and then the memory for the new resized image (add on the original jpg file size+final jpg file size).

Unless you have a zoom mod to also show the hi-res detail, you are wasting time+bandwidth by uploading images at that resolution.

That said, the least number of compression cycles, the better, so you could either resize direct to 390x390 (and allow CubeCart to create the thumbnails), or change your workflow so you edit at 2000x2000, and save a lower res (ie 1000x1000) as well as your full res (I guess you may want to print etc).

Anyway, I've done quite a bit of GD work (not CubeCart related), and this is a common problem with images with high dimensions, ie the filesize is not normally the issue but the unpacked memory requirements of the image are.

There are a few tweaks that could help;

Backup .htaccess

Edit .htaccess

add:

php_value memory_limit 32M




If this causes a problem, replace .htaccess with your backup.





You can also increase the memory size in the resize script.

/admin/sources/filemanager/resize.inc.php



Backup the file first.



Find:


$lang = getLang("admin".CC_DS."admin_filemanager.inc.php");




Just before, add;


ini_set("memory_limit","32M");

Save and then test..

If there is an error, revert back to your backup.

There is also a limit on the data that a form can send - I doubt this your problem as a 400KB file is not large - in fact as a little too small for an image of that size to retain high quality.

Anyway, some pointers for you - if you're not that technical, simply use low resolution images.

I use irfranview to batch resize images, so it shouldn't be too difficult.

Hope this helps,

Jason

Link to comment
Share on other sites

Thanks to you both for replying,

Robsta, I have toggled this on and off to verify that it has nothing to do with the issue and it seems fine. I have not changed any of the values other that the Yes/No.

Vokf, you are very thorough, it seems strange that I had other images, at the same size work fine, then these didnt. I ended up resizing them to be 390x390 and of course, no problem. As a note, I decided to move on and get more images created and they too were at 2000x2000 and they were accepted by the system with absolutely no issue. Very strange. I know the workaround and that is fine, but naturally, this could create concern for other issues down the line.

So I decided while typing this to try one more test. I took one of the problem files and re-exported it from Photoshop and tried to upload it again, no problems.

So now that I know this is flaky I will just keep an eye on how this is working. Ugh

Thanks for the replies and the code hints. As we are just setting this up for our new store we are learning as we go.

All the best!

Link to comment
Share on other sites

I guess the main thing is, this is probably not a CubeCart problem, I've coded my own gallery for a non-CC site and my client had problems uploading images.

I've also used the Gallery2 project in the past, and that also struggles with large images.

I think this is really a problem with shared hosting and an unknown level of resources. Get a dedicated server to ensure it works :rolleyes:

One thing to try is to upload at non-peak time. Obviously, if this is a UK server then *now* (checks clock!) would be a good time.

I would advise not to upload 390x390 images through admin (if this is your required size), as CubeCart will resave the jpg (with another layer of compression artifacts).

Best to FTP them into the /images/uploads folder, assign to a product and then ask CC4 to rebuild thumbnails.

This will give you one less cycle of compression, and much cleaner images.

Anyway - look forward to seeing the site!

jason

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...