Coder Social home page Coder Social logo

Comments (5)

nomadic-energy-dev avatar nomadic-energy-dev commented on August 16, 2024

Additional info from local debugging: this is the unserialized meta data from one of the images causing the error:

This is the raw unserialized meta data from the database:

Array
(
[width] => 100
[height] => 100
[file] => Website-Icons-68.svg
[sizes] => Array
(
[thumbnail] => Array
(
[width] => 150
[height] => 150
[crop] => 1
[file] => Website-Icons-68.svg
[mime-type] => image/svg+xml
)

        [medium] => Array
            (
                [width] => 300
                [height] => 300
                [crop] => 
                [file] => Website-Icons-68.svg
                [mime-type] => image/svg+xml
            )

        [medium_large] => Array
            (
                [width] => 768
                [height] => 0
                [crop] => 
                [file] => Website-Icons-68.svg
                [mime-type] => image/svg+xml
            )

        [large] => Array
            (
                [width] => 1024
                [height] => 1024
                [crop] => 
                [file] => Website-Icons-68.svg
                [mime-type] => image/svg+xml
            )

        [1536x1536] => Array
            (
                [width] => 
                [height] => 
                [crop] => 
                [file] => Website-Icons-68.svg
                [mime-type] => image/svg+xml
            )

        [2048x2048] => Array
            (
                [width] => 
                [height] => 
                [crop] => 
                [file] => Website-Icons-68.svg
                [mime-type] => image/svg+xml
            )

        [woocommerce_thumbnail] => Array
            (
                [width] => 
                [height] => 
                [crop] => 
                [file] => Website-Icons-68.svg
                [mime-type] => image/svg+xml
                [uncropped] => 
            )

        [woocommerce_single] => Array
            (
                [width] => 
                [height] => 
                [crop] => 
                [file] => Website-Icons-68.svg
                [mime-type] => image/svg+xml
            )

        [woocommerce_gallery_thumbnail] => Array
            (
                [width] => 
                [height] => 
                [crop] => 
                [file] => Website-Icons-68.svg
                [mime-type] => image/svg+xml
            )

        [shop_catalog] => Array
            (
                [width] => 
                [height] => 
                [crop] => 
                [file] => Website-Icons-68.svg
                [mime-type] => image/svg+xml
            )

        [shop_single] => Array
            (
                [width] => 
                [height] => 
                [crop] => 
                [file] => Website-Icons-68.svg
                [mime-type] => image/svg+xml
            )

        [shop_thumbnail] => Array
            (
                [width] => 
                [height] => 
                [crop] => 
                [file] => Website-Icons-68.svg
                [mime-type] => image/svg+xml
            )

        [dgwt-wcas-product-suggestion] => Array
            (
                [width] => 
                [height] => 
                [crop] => 
                [file] => Website-Icons-68.svg
                [mime-type] => image/svg+xml
            )

    )

)

This is the var_dump of the meta the plugin is using at the point of exception - you can see the width and height is missing:

array(4) {
["width"]=>
int(0)
["height"]=>
int(0)
["file"]=>
string(20) "Website-Icons-68.svg"
["sizes"]=>
array(10) {
["woocommerce_thumbnail"]=>
array(6) {
["width"]=>
bool(false)
["height"]=>
bool(false)
["crop"]=>
bool(false)
["file"]=>
string(20) "Website-Icons-68.svg"
["mime-type"]=>
string(13) "image/svg+xml"
["uncropped"]=>
bool(false)
}
["woocommerce_gallery_thumbnail"]=>
array(5) {
["width"]=>
bool(false)
["height"]=>
bool(false)
["crop"]=>
bool(false)
["file"]=>
string(20) "Website-Icons-68.svg"
["mime-type"]=>
string(13) "image/svg+xml"
}
["woocommerce_single"]=>
array(5) {
["width"]=>
bool(false)
["height"]=>
bool(false)
["crop"]=>
bool(false)
["file"]=>
string(20) "Website-Icons-68.svg"
["mime-type"]=>
string(13) "image/svg+xml"
}
["dgwt-wcas-product-suggestion"]=>
array(5) {
["width"]=>
bool(false)
["height"]=>
bool(false)
["crop"]=>
bool(false)
["file"]=>
string(20) "Website-Icons-68.svg"
["mime-type"]=>
string(13) "image/svg+xml"
}
["thumbnail"]=>
array(5) {
["width"]=>
string(3) "150"
["height"]=>
string(3) "150"
["crop"]=>
string(1) "1"
["file"]=>
string(20) "Website-Icons-68.svg"
["mime-type"]=>
string(13) "image/svg+xml"
}
["medium"]=>
array(5) {
["width"]=>
string(3) "300"
["height"]=>
string(3) "300"
["crop"]=>
bool(false)
["file"]=>
string(20) "Website-Icons-68.svg"
["mime-type"]=>
string(13) "image/svg+xml"
}
["medium_large"]=>
array(5) {
["width"]=>
string(3) "768"
["height"]=>
string(1) "0"
["crop"]=>
bool(false)
["file"]=>
string(20) "Website-Icons-68.svg"
["mime-type"]=>
string(13) "image/svg+xml"
}
["large"]=>
array(5) {
["width"]=>
string(4) "1024"
["height"]=>
string(4) "1024"
["crop"]=>
bool(false)
["file"]=>
string(20) "Website-Icons-68.svg"
["mime-type"]=>
string(13) "image/svg+xml"
}
["1536x1536"]=>
array(5) {
["width"]=>
int(1536)
["height"]=>
int(1536)
["crop"]=>
int(0)
["file"]=>
string(20) "Website-Icons-68.svg"
["mime-type"]=>
string(13) "image/svg+xml"
}
["2048x2048"]=>
array(5) {
["width"]=>
int(2048)
["height"]=>
int(2048)
["crop"]=>
int(0)
["file"]=>
string(20) "Website-Icons-68.svg"
["mime-type"]=>
string(13) "image/svg+xml"
}
}
}

from cloudinary_wordpress.

nomadic-energy-dev avatar nomadic-energy-dev commented on August 16, 2024

This was directly related to SVG support in Wordpress. The SVG plug we were using (SVG Support - most popular!) was not setting the widths for SVGs where WP's attachment functions were not.

We installed a different plugin (Safe SVG) and the problem is solved.

I think there is still a bug here where if this does happen, it would be useful to set a default or to throw an error more helpful to customers to find a solution rather than spending time debugging core WP attachment handling and Cloudinary's plugin code.

from cloudinary_wordpress.

Vdeub-cloudinary avatar Vdeub-cloudinary commented on August 16, 2024

Hi @nomadic-energy-dev, Is it only a specific SVG that was throwing the error? Would you have the SVG in question so I can have a look? Could you also share if SVG Support under the Cloudinary Image settings was enabled?. Thanks!

from cloudinary_wordpress.

nomadic-energy-dev avatar nomadic-energy-dev commented on August 16, 2024

Thanks - enabling svg support resolved this. Could we improve error handling to catch and report a more useful error in this case?

from cloudinary_wordpress.

Vdeub-cloudinary avatar Vdeub-cloudinary commented on August 16, 2024

@nomadic-energy-dev awesome news! Glad it fixed the issue. I'll share this with our development team in case there is anything they can do.

from cloudinary_wordpress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.