Images take a long time to load in add listing page

My website implementing RentalHive

  • Attempting to Select Images in Submit Listing page results in infinite loading on Select Images button and images never show up.
  • Upon page refresh (after 10s), 2 images appear selected (out of 7 total selected for upload) - waiting for longer shows more images (a few minutes - 4 of 7 images appeared)

RentalHive demo website

  • Attempting to Select Images in Submit Listing page results in a really long wait time (more than 1min) with Select Images in “busy mode” for 1 or 2 images to appear (out of 7)
  • Upon page refresh, some images appear depending on wait time before refresh - longer wait = more images selected

Steps to reproduce

  1. Go to /submit-listing/details page
  2. Click on select image
  3. Select a set of images (7 in this case, total of 4.64MB) - Issue happens here (infinite loading)
  4. (Optional) Refresh page, based on how much you waited - a number of images will appear

Actual result

Images selected not being loaded fast enough into the form.

Expected result

Images should be attached to the form faster (within seconds) - not even expecting it to be uploaded to WordPress yet, until the Listing is submitted.

Extra details

Settings on my website:

  • Caching purged and then disabled globally
  • All plugins disabled except HivePress plugins

I also have screenshots of my cache settings, plugins and the issue for my website - but I am not allowed to upload more than 1 media item as a new user.

GIF (Recording) of issue reproduced (not exactly - see description) on RentalHive demo site:
Image-Upload-Slow-Or-Not-Working

Hi,

Please disable third-party plugins and customizations (if there are any) and check if this issue persists. If you use a caching plugin, make sure that caching is disabled for logged-in users.

If this issue exists, please send temporary WP access to support@hivepress.io with details for reproducing this issue, and we’ll check it (please send only the link, without login and password). You can create a temporary access link using this plugin Temporary Login Without Password – WordPress plugin | WordPress.org.

I had all plugins disabled (leaving only HivePress ones) and disabled all caching options in WordPress settings - as mentioned in my post.

  • The GIF shows a very similar issue on the RentalHive demo website.

I will reach out to the support email you provided.
Thank you.

Hi,

We have checked this issue, and everything is working correctly on our side. We recommend that you contact your hosting provider, as they may have restrictions or limits on download speeds, etc.

Hello andrii.

I beg to differ based on the following test I did:

  • Opened the website on the right, and the WordPress Media Library on the left.
  • Attempted the upload of a single image (383KB)
  • Continuously refreshed the Media Library on the left (manually)
  • Notice how the image is in the Media Library within seconds, but the form is still loading
  • This indicates that the upload is actually good/fast

I ended my recording there, but the form kept loading for more than a minute before I closed the window.

Recording

Image-Upload-Slow-Or-Not-Working-Proof

Do not ignore the GIFs I am attaching.
Since video is not allowed here, this is the only way to visualize my investigation.

And also,

I still have the following reasons in addition to the test above:

  1. I have contacted the hosting provider, and they confirmed that there is no speed limitation.
  2. You have yet to address the similar issue on RentalHive demo website.
  3. When uploading an image directly to the Media Library, it goes fast. If the issue was due to server limitations/hosting, I should have experienced it in all image upload situations.

Please do not disregard this issue lightly.

Thank you.


On a side note, it is unusual that the “Select Images” button is uploading to WordPress even when the form is not submitted - but I will leave that topic for another time.

Hi,

Thank you for the detailed explanation, but we still haven’t been able to reproduce the issue on our end. I recommend you try to reproduce the same issue on our demo site.

Please refer to the original topic posted.
I included a detailed explanation of how the issue was reproduced on the RentalHive demo website along with a GIF recording of it (also from the demo website).

Hi,

We have tested it on the demo version and locally, and everything works correctly. Please check this screencast Screencastify.
Also, please note that HivePress cannot affect the loading speed in any way. We are just using WordPress functions, as we said earlier. Further, it depends on the hosting, limits, internet connection, additional customizations, etc.

Hello andrii.

I have tested this functionality on different devices, different internet connections (home, mobile, corporate - high speed) and reviewed the hosting and limitations.

I also have close to no customizations of the RentalHive theme/plugins.
The only changes I made are:

  • Removal of some attributes from listing
  • Added a checkbox attribute

As mentioned before, I also disabled all plugins except HivePress ones during my tests.

Yet the issue always persisted.

I have a solution

I thought of shifting from Imagick to GD for image processing.
My understanding is that both are supported by WordPress and should not pose an issue in my use-case where I just want to allow basic image upload, no advanced manipulations.

I modified the functions.php file in RentalHive.
File at: public_html/wp-content/themes/rentalhive/functions.php

Below is what the full code file looks like now.

<?php
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

// Include the theme framework.
require_once __DIR__ . '/vendor/hivepress/hivetheme/hivetheme.php';

/*
 * Custom code snippet starts here
 */
function wpb_image_editor_default_to_gd( $editors ){
    $gd_editor = 'WP_Image_Editor_GD';
    $editors= array_diff( $editors, array( $gd_editor) );
    array_unshift( $editors, $gd_editor);
    return$editors;
}
add_filter( 'wp_image_editors', 'wpb_image_editor_default_to_gd');
/*
 * Code snippet ends here
 */

Results

Images are now uploaded without issues.

My Question

Do you anticipate any issues from this code change, or anything I should be wary of?
Consider from your plugins and RentalHive theme perspective as well please.

Thank you.

Hi,

Thank you for sharing this solution with the community. But we would also like to reiterate that this is a WP-level issue. The HivePress extension only calls the media_handle_upload function. With HivePress, we cannot decide which PHP library is used to load and process images at the WP level. This would be a violation.

Also, we recommend adding snippets through a child theme or the Code Snippet plugin because all the data will be restored after the update on our part if you change the direction or add this snippet in the theme files.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.