Connections-Business-Directory / Connections

Directory Plugin for WordPress
https://connections-pro.com
GNU General Public License v2.0
26 stars 18 forks source link

webp images #493

Open estlacksensory opened 9 months ago

estlacksensory commented 9 months ago

Recent release of connections -> 10.4.56

It looks like webp is supposed to have support, but images are not appearing - broken links. Had to download webp images and convert to jpg and upload. Using some performance plugins that convert jpg to webp on upload. Is there a conflict here? Something else going on?

https://github.com/Connections-Business-Directory/Connections/blame/0f369572c66992e8bba1287ac4d18e09720a0bc6/includes/image/class.image.php#L1823

shazahm1 commented 9 months ago

This has been reported once before, but I have not been able to replicate this issue.

Have you tried the plugin conflict test? I have seen optimization plugins rewrite image URL/s and fail, leading to broken image links.

Can you share a link to a page showing the issue?

estlacksensory commented 9 months ago

Using WPRocket with Imagify for webp images + WP Performance Lab. Looks like connections creates its own unique directories in the standard images dir, when uploading headshots.

I disabled the Performance Lab feature - "Enable WebP". Which brought back the image feature for connections. This was based on a comment here: https://wordpress.org/support/topic/super-but-doesnt-work-with-webp/ - Performance Lab's WebP Enable feature will let you upload a jpg and then it will create a bunch of differently sized webp images. But connections wasn't linking to any of them, not even the original jpg.

It seems that if there's an option to choose between a webp image and a jpg, the performance decision (for Connections) would be to go with webp. For this page - https://westliberty.edu/westbusiness/directory/ There is a folder in an image directory for "Chris McPherson" which has identical files for webp and jpg (uploaded manually). Connections is choosing the jpg image. Also, after uploading .jpeg images - those didn't work + had to upload .jpg - without the "e".

I wonder if the standard WP media directory could be used + just use imagemagic to handle the unique cropping that connections wants to do?

My guess is that I should also be able to have the webp functionality on, for performance lab + not have to disable it for connections to work. Other plugins seem unaffected by this. I guess a question is why require a unique folder for the connections images?

Thanks for fielding this question.

estlacksensory commented 9 months ago

"Other plugins seem unaffected by this" - meaning, there are fallbacks where webp isn't fully supported, eg. Elementor using jpg instead of webp in background images. So it's not implemented 100% across the board.

shazahm1 commented 9 months ago

The performance labs plugin will only work with images loaded into the media library. So, if it affects other images, then that may be a bug in the lab plugin. I did add the labs plugin and enabled the web feature, but it did not affect the images on my dev/test instance. So, a specific set of circumstances must occur for the issue to present itself.

There are a few reasons Connections does not use the media library...

  1. Connections is older than the Media Library. Back then, I considered a migration process but decided against it—a good decision for permanence and scalability.
  2. There are quite a few private sites that use Connections for large directories. Loading many thousands of images in the Media Library would make it less usable, and the site less performant, as each image in the Media Library is just a post with quite a bit of metadata attached.
  3. On-demand scaling and cropping without registering additional image sizes or variations with WP and regenerating the new thumbnails.

Connections does not choose an image type for you; it will use the uploaded image. Also, it is not possible to manually upload an image and have Connections use it. The image has to be uploaded as part of adding or editing the directory entry. The only exception would be if one were to manually update the database record for the entry to reference manually uploaded images.

I believe I answered your questions. Please let me know if I have missed anything.

I want to resolve the image not showing up when the labs feature is enabled. To do this, I'll need to see an example of how the image links are altered to track down why.

estlacksensory commented 9 months ago

Hello again. Between Performance Lab and Connections - when uploading a jpg, Connections will take the jpg. Then it looks like Performance Lab will create webp images. Connections will then look for the most recently created file in the profile's directory and use that to try and display the image. However, it will still use .jpg as the file extension (because that's what was uploaded?), whether it's a webp, or a jpg. So, recently, I've had to upload the jpg - see that PerfLab created the webp images, then go into the directory with FTP software and change them all to jpgs and it seems to work OK.

Thought this would provide some insight.