Keyword

K2 Item Images

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Premium Member
More
7 months 5 days ago #174282 by Red Evolution
K2 Item Images was created by Red Evolution
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
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
7 months 5 days ago #174286 by Fotis
Replied by Fotis on 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
  • Premium Member
More
7 months 5 days ago #174292 by Red Evolution
Replied by Red Evolution on 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
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
7 months 4 days ago #174298 by Fotis
Replied by Fotis on 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.

More
5 months 5 days ago #175065 by bill hyde
Replied by bill hyde on topic K2 Item Images
"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 of GBs on large sites? "

You are missing the point. Not everyone has fast fibre connections to the Internet, not everyone has cheap storage and why in these days of responsive sites does any program have to make 6 copies of any image? It should be up to the site owner if they want multiple image versions, they should be able to enable/disable image usage as it suits them.

A massive cache of 6 versions per image takes forever to back up on slow Internet connections, which exist throughout the world.

You really should look at this again and make it a priority - looking through the forum, this question comes up time & time again. Please fix it and make your users happy.

(I'd be happy to pay for a version of K2 if this issue and other biggies were solved).

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

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
5 months 3 days ago #175076 by Fotis
Replied by Fotis on topic K2 Item Images
I respectfully disagree. In fact, I'm seeing the entire opposite. Users don't care. But I don't disagree because of that.

Inevitably, at some point, even with just 1, 2 or 3 sizes per image, you will hit a few GBs in size. If your backup strategy is using something like Akeeba Backup (AB), I'm sorry, but you're doing things the wrong way. AB is an entry-level backup solution for small sites. Anything beyond 1-2 GBs in size and it makes no sense to use AB.

On the other hand, backing up everything over FTP is also an impractical solution.

Instead, you should invest a couple of hours learning how to use tools like rsync and mysqldump on Linux based servers. With rsync commands, you can backup a 200GB site in a matter of minutes (after the first run). With mysqldump (combined with gzip) you can export GBs of MySQL/MariaDB data to just a few MBs in minutes and retrieve the compressed archives in even less. Automate all the above with simple bash/shell scripts and cron jobs and you'll never have to worry about backing things up again.

Got no time to learn about rsync/mysqldump? Use proven tools like:
Restic - restic.net/
BackupPC - backuppc.github.io/backuppc/
AutoMySQLBackup - sourceforge.net/projects/automysqlbackup/

For the record, I operate some of the largest K2 sites worldwide. Sites with more than half a million items in them. These sites may range from just 60GB to 250GBs tops. Compare that with similar Drupal or WordPress sites (which also do multi-resizing) and you are looking at almost double these sizes. I was going to compare with regular Joomla articles but, oh wait... it doesn't do image resizing...

P.S. You seem to be based in the UK. Check contabo.com (in Germany) for VMs with massive SSD (in RAID 10) storage at ridiculous pricing and performance to make the likes of DigitalOcean, AWS Lightsail, Linode, Vultr etc. seem like SATA based... And it's not just Contabo. There's OVH and their Kimsufi brand, Online.net/Scaleway, Hetzner, UpCloud and many, many more.

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