• Can not upload SVG images to GCS. It has been working before the latest updates. Not sure exactly when it stopped working. Other formats work (PNG, JPEG, JPG).

    “image.svg
    An error occurred in the upload. Please try again later.”

    Here is the error log.

    Error: Call to undefined method Monolog\Utils::expandIniShorthandBytes():

    at .Google\Client->createDefaultLogger ( /var/www/site-example/wordpress/wp-content/plugins/wp-stateless/lib/Google/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:58 )
    at .Google\Client->getLogger ( /var/www/site-example/wordpress/wp-content/plugins/wp-stateless/lib/Google/src/Client.php:1124 )
    at .Google\Service\Resource->call ( /var/www/site-example/wordpress/wp-content/plugins/wp-stateless/lib/Google/src/Service/Resource.php:187 )
    at .Google\Service\Storage\Resource\Objects->insert ( /var/www/site-example/wordpress/wp-content/plugins/wp-stateless/lib/Google/src/Service/Storage/Resource/Objects.php:264 )
    at .wpCloud\StatelessMedia\GS_Client->add_media ( /var/www/site-example/wordpress/wp-content/plugins/wp-stateless/lib/classes/class-gs-client.php:257 )
    at .wpCloud\StatelessMedia\Utility::add_media ( /var/www/site-example/wordpress/wp-content/plugins/wp-stateless/lib/classes/class-utility.php:352 )
    at .WP_Hook->apply_filters ( /var/www/site-example/wordpress/wp-includes/class-wp-hook.php:307 )
    at .apply_filters ( /var/www/site-example/wordpress/wp-includes/plugin.php:191 )
    at .wp_update_attachment_metadata ( /var/www/site-example/wordpress/wp-includes/post.php:6584 )
    at .wp_maybe_generate_attachment_metadata ( /var/www/site-example/wordpress/wp-includes/media.php:4976 )
    at .PLL_Admin_Advanced_Media->duplicate_media ( /var/www/site-example/wordpress/wp-content/plugins/polylang-pro/modules/media/admin-advanced-media.php:121 )
    at .WP_Hook->apply_filters ( /var/www/site-example/wordpress/wp-includes/class-wp-hook.php:307 )
    at .WP_Hook->do_action ( /var/www/site-example/wordpress/wp-includes/class-wp-hook.php:331 )
    at .do_action ( /var/www/site-example/wordpress/wp-includes/plugin.php:476 )
    at .wp_insert_post ( /var/www/site-example/wordpress/wp-includes/post.php:4596 )
    at .wp_insert_attachment ( /var/www/site-example/wordpress/wp-includes/post.php:6301 )
    at .media_handle_upload ( /var/www/site-example/wordpress/wp-admin/includes/media.php:419 )
    at .wp_ajax_upload_attachment ( /var/www/site-example/wordpress/wp-admin/includes/ajax-actions.php:2569 )
    at .{main} ( /var/www/site-example/wordpress/wp-admin/async-upload.php:33 )

Viewing 1 replies (of 1 total)
  • Thread Starter vraisa

    (@vraisa)

    This is still not working, but here is work around for this.

    Create a script to watch changes in the uploads folder. You need inotify-tools

    watch-wp-uploads.sh

    #!/bin/sh
    dir1=/var/www/wordpress/wp-content/uploads/
    while inotifywait -qqre modify "$dir1"; do
        gsutil -m rsync -rd /var/www/wordpress/wp-content/uploads/ gs://bucketdomain.com/wp-content/uploads
    done

    watch-wp-uploads.service

    [Unit]
    
    Description=Watch WordPress uploads folder changes and rsync them to the cloud storage
    
    After=default.target
    
    [Service]
    
    ExecStart=/root/watch-wp-uploads.sh
    
    [Install]
    
    WantedBy=default.target

    systemctl enable watch-wp-uploads.service
    systemctl start watch-wp-uploads.service

    • This reply was modified 2 years, 5 months ago by vraisa.
Viewing 1 replies (of 1 total)
  • The topic ‘Can not upload SVG images’ is closed to new replies.