Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jrigexor

    (@jrigexor)

    After some further digging, it appears that there were some changes made to managed database servers (when this was I don’t know – I only recently noticed these errors) on Digital Ocean. The sql mode includes ANSI_QUOTES under the database settings which causes queries with double quotes to fail. Removing the ANSI_QUOTES settings fixes this issue and also address this problem that occurs with other plugins. Sorry for the mix up – hopefully if someone else sees this it can address their issue, and if anyone on your support forum shows up with a similar issue this can help them resolve it as well.

    @garcia05mg I think MIME types don’t have any spaces between each portion, so shouldn’t the above instead be:

    function allowed_mime_types ( $types ) {
    	$types['svg'] = 'image/svg+xml';
    	$types['svgz'] = 'image/svg+xml';
    	$types['doc'] = 'application/msword';
    	$types['json'] = 'application/json';
    	return $types;
    }

    Although if this is just a formatting issue when posting you can disregard this comment.

    Even with that change however, you might still run into the same issue I am having. In the most recent update, the function

    ‘wp_update_attachment_metadata’

    aborts attempting to upload files to s3 if no additional resized images are generated when it makes this check (on line 1064 in ‘classes/amazon-s3-and-cloudfront.php’):

    // Protect against updates of partially formed metadata.
    if ( wp_attachment_is_image( $post_id ) && empty( $data['sizes'] ) ) {
    	return $data;
    }

    You could probably try replacing the above code (again, at line 1064 in ‘classes/amazon-s3-and-cloudfront.php’) with something like this:

    // Protect against updates of partially formed metadata.
    $mime_type = get_post_mime_type( $post_id );
    if ( wp_attachment_is_image( $post_id ) && empty( $data['sizes'] ) && $mime_type != "image/svg+xml" ) {
    	return $data;
    }

    and see if you can upload svg files then.

    After double checking, it looks like the old version of the plugin never enforced this check. To me this looks like a bug, since, as you pointed out @sirschuyler , it is possible to force WordPress to not generate these extra images, which means this check will *always* fail and won’t upload images to your s3 bucket. It looks like there are some funky intermediate things going on during the process of media management, and this extra check was trying to catch it. It just appears to be overly aggressive and missing certain edge cases. Have you look at this @ianmjones ?

    I’ve run into the same issue. For me, it appears that the problem is with uploading small files. File sizes less than 150×150 will not cause WordPress to generate resized images, and so then in the amazon cloud front plugin in file:

    amazon-s3-and-cloudfront.php

    In the method:

    wp_update_attachment_metadata

    The line that calls this test:

    // Protect against updates of partially formed metadata.
    if ( wp_attachment_is_image( $post_id ) && empty( $data['sizes'] ) ) {
    	return $data;
    }

    fails because the data sizes is always empty on these smaller files. If I upload a larger file, however, the resize works, and the plugin can correctly upload the file data.

Viewing 4 replies - 1 through 4 (of 4 total)