• Resolved damianzaremba

    (@damianzaremba)


    On a wordpress 6.9.4 installation, with “full cloud migration” enabled, when editing an image (e.g. applying a crop via the media gallery) the image fails to offload.

    After some debugging it appears both the ThumbnailRegenerationObserver and AttachmentUpdateObserver classes are being triggered, resulting in the first call offloading the files and the second fall failing due to the files missing on disk.

    This causes the previously offloaded file to become “local” with an error along the lines of:

    Failed to upload size 'medium' to cloud storage. Please review your Cloud provider credentials or connection settings. For more details, enable debug.log and check the logs.

    And a PHP error along the lines of:

    [02-May-2026 15:28:34 UTC] Advanced Media Offloader: Error uploading file to S3: Unable to open "/workspace/wp-content/uploads/a74c6b052aef9b72c958734e525d9d7a-e1777735712599-289x300.jpeg" using mode "r": fopen(/workspace/wp-content/uploads/a74c6b052aef9b72c958734e525d9d7a-e1777735712599-289x300.jpeg): Failed to open stream: No such file or directory

    Disabling the ThumbnailRegenerationObserver which is gated to only be run with images allows the images to be edited successfully, an example hook for this is as below:

    // Disable uploads triggered by ThumbnailRegenerationObserver if
    add_filter(
    'advmo_should_offload_attachment',
    function($should_offload, $attachment_id) {
    $found_image_save = $found_thumbnail_observer = false;
    foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10) as $element) {
    if (
    array_key_exists( 'class', $element ) &&
    $element['class'] == 'Advanced_Media_Offloader\Observers\ThumbnailRegenerationObserver' &&
    array_key_exists( 'function', $element ) &&
    $element['function'] == 'run'
    ) {
    $found_thumbnail_observer = true;
    }

    if ( array_key_exists( 'function', $element ) && $element['function'] == 'wp_save_image' ) {
    $found_image_save = true;
    }

    if( $found_thumbnail_observer && $found_image_save ) {
    return false;
    }
    }
    return true;
    },
    10,
    2
    );

    Image edited was previously working, but I’ve not been able to pin down exactly where this stopped working.

    The most basic reproduction steps:

    1. Enable the plugin with “Full Cloud Migration”
    2. Upload an image
    3. Edit the image
    4. Observe saving the edited image fails
Viewing 1 replies (of 1 total)
  • Plugin Author Masoud Golchin

    (@masoudin)

    Hi @damianzaremba
    Thank you for flagging this bug and providing the steps to replicate it.

    We have successfully replicated the issue and included a fix in the next release of the Advanced Media Offloader, which will be available later today.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.