Keyword

K2 Item Images

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Senior Member
More
1 week 5 days ago #174282 by Red Evolution
Red Evolution created the topic: K2 Item Images
Hi Fotis,

Got a query regarding how the images within K2 are processed when they are uploaded. I have just discovered on a clients site that when I upload the images to it, the original image in the src folder has its size increased which doesn't help when it comes to us trying to optimise the images as much as possible. An example of this is I uploaded a 300px x 300px image in jpg format with a file size of 19px to a K2 item within the 'Image' tab. When I found this image in the src though, it was 300px x 300px as expected but the file size was now 44kb. Within the cache folder, I then located the Medium sized version which is set to also be 300px x 300px and it was also 44kb.

Any ideas why K2 is dramatically increasing the file size of the src image? Surely it should stay exactly the same size and the cached one should be the same size or smaller.

Thanks,
Dave

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
1 week 5 days ago #174286 by Fotis
Fotis replied the topic: K2 Item Images
Unfortunately it's PHP's GD2 image library to blame. It does not offer the same level of compression as dedicated image processing apps or libraries do. However, I do plan on swapping the current upload (and resize) library used in K2 with another one ( github.com/avalanche123/Imagine ) that can hook up to different image libraries (better than GD2). So if you had ImageMagick installed on your server with the right PHP module installed, it would use that instead of GD2.

Until then you can experiment with lower upload quality (you probably have a setting above 90%) or -even better- you can use a CLI tool like jpegoptim which can scan all your site's image folders and optimize all JPEG images.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Senior Member
More
1 week 4 days ago #174292 by Red Evolution
Red Evolution replied the topic: K2 Item Images
Thanks for the quick response Fotis. Look forward to seeing the new version with the updated image processing as that will be really handy on a lot of our client sites. A couple of other suggestions I have relating to images would be:

- Ability to disable image sizes that aren't required so they aren't created in the cache folder
- Ability to regenerate cached images if you change the size of them in the settings

I realise they probably aren't quick and easy suggestions to implement, but they would definitely be very useful to have.

Thanks,
Dave

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
1 week 4 days ago #174298 by Fotis
Fotis replied the topic: K2 Item Images
The option to rebuild your K2 images exists now in the form of this CLI PHP script: github.com/getk2/rebuildK2imageCache

But I do have plans for a new plugin that can do the same thing on-demand and not en-masse (which may take hours for large sites).

As for disabling certain image sizes, at the moment these are hardcoded in XML files in K2 and many third party extensions, so it's not an easy task. Besides, with today's cheap storage, does it really matter to save a couple GBs on large sites?

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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


Powered by Kunena Forum