• Resolved Hugo

    (@goncalveshugo)


    Hi there!
    Thank you for this great plugin.
    I have a problem and i’m wondering if can be addressed somehow.

    I have a website that has many SVG files. Since the SVG Support plugin generates preview images in SVG, the media library becomes painlessly slow. When a new upload is to be made, it takes for ever to respond, and i’m on a fast computer. Disabling the plugin removes the previews and fixes it. (thankfully WP reinstated the SVG format upload in some recent version, or so it seems)

    Is a raster image (JPG or even better a PNG) as preview format in the media library, possible or in the works for a future version?

    Thank you
    Hugo Gon?alves

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Benbodhi

    (@benbodhi)

    Hi there,

    Thanks for using my plugin!

    This sounds very odd. My plugin should not be slowing down your library at all.
    SVG files are usually much smaller than JPG or PNG, so it seems strange.

    Have you tested with default twentyseventeen theme and no other plugins active?

    Sounds like something else conflicting maybe…

    I’d be happy to take a quick look if you can provide temporary admin login details to [email protected]

    Thread Starter Hugo

    (@goncalveshugo)

    Hi Benbodhi!

    I think is more related with rendering i guess, than with size. Every button / form field in the media library becomes unresponsive for a while (a long while).
    This is 79 SVG files, we’re talking about! (oO)

    Haven’t yet. I will try to test today with a clean install and i’ll report the findings here.

    Sorry, can’t do that with this one.

    Thank you
    Hugo Gon?alves

    Plugin Author Benbodhi

    (@benbodhi)

    Hey,

    Well, it doesn’t actually take much to render the visual of an SVG… I’d be interested to know what’s happening there.
    Also very interested why you have sooooo many SVG files?

    Testing on a clean install is likely not going to help. You need to follow standard troubleshooting to find the issue in your existing install or a clone of it. If you can’t be fiddling with the theme and plugins, I suggest cloning it to a staging subdomain and trying there.

    As mentioned I’d love to see what is happening exactly.

    Plugin Author Benbodhi

    (@benbodhi)

    How did you go with this?

    I have tested with hundreds of SVG files in the media library with no issue…

    Thread Starter Hugo

    (@goncalveshugo)

    Hey Benbodhi!

    Sorry for the absence of replies.

    After a lot of work and a much needed vacation, i completely forgot about everything, including this. :\

    Still wasn’t able to test it out. I have a few busy weeks ahead, and after that, i will look into this.

    Cheers
    Hugo

    Plugin Author Benbodhi

    (@benbodhi)

    Thanks for your reply Hugo.

    I look forward to hearing how you go.

    Plugin Author Benbodhi

    (@benbodhi)

    I feel like this is a theme issue because WordPress does not support SVG files by default so if you can upload when my plugin is not active, whatever is allowing that upload is what would be creating the issues. I’ve found a lot of themes that add a small amount of SVG support but do not address issues within the media library.

    I’ll mark this as resolved for now as I have a feeling that’s all it is and it’s unrelated to my plugin. But please do update this thread once you test so we know exactly what caused it. Or if you can’t figure it out, I’ll be happy to help.

    Cheers
    Ben

    Thread Starter Hugo

    (@goncalveshugo)

    Hmm, now you got me thinking.

    I assumed (i know i know, one should never assume anything), that wp got svg support back again due to all the complaining about its removal.

    It might be some other plugin messing things.
    Here’s the list:
    – Advanced Custom Fields PRO
    – Cache Enabler (by KeyCDN)
    – iThemes Security
    – Polylang
    – Post Types Order
    – UpdraftPlus – Backup/Restore
    – WP Remote
    – WP Sanitize Accented Uploads (you wouldn’t believe the filenames people upload)
    – XML Sitemap & Google News feeds

    On my end. It’s a custom theme, built on top of Themekraft. However keeping hopes that svg support would return one day, i kept these handy filters, that could also be a suspect:

    function modify_post_mime_types( $post_mime_types ) {
        $post_mime_types['application/pdf'] = array( __( 'PDFs' ), __( 'Gerir PDFs' ), _n_noop( 'PDF <span class="count">(%s)</span>', 'PDFs <span class="count">(%s)</span>' ) );
        $post_mime_types['application/zip'] = array( __( 'ZIPs' ), __( 'Gerir ZIPs' ), _n_noop( 'ZIP <span class="count">(%s)</span>', 'ZIPs <span class="count">(%s)</span>' ) );
        return $post_mime_types;
    
    }
    add_filter( 'post_mime_types', 'modify_post_mime_types' );
    
    function custom_mtypes( $m ){
        $m['svg'] = 'image/svg+xml';
        $m['svgz'] = 'image/svg+xml';
        return $m;
    }
    add_filter( 'upload_mimes', 'custom_mtypes' );

    Cheers
    Hugo

    • This reply was modified 7 years, 6 months ago by Hugo.
    Plugin Author Benbodhi

    (@benbodhi)

    WordPress never supported SVG as far as I know…

    With my plugin, you don’t need that custom mime type function, so I would remove that one.

    The plugin list, at least you don’t have many to check against… The one that stands out to me is “WP Sanitize Accented Uploads (you wouldn’t believe the filenames people upload)” because it deals with uploads also. That’s the first place I would look or should I say, first plugin to disable and check.

    Thread Starter Hugo

    (@goncalveshugo)

    Not by default, but with those filters above it did, up to a point.

    Did a quick google search and you can see it here or here for example.

    When it happened i had to look for an alternative way and tested a few, and your plugin was the only that did a decent job.

    I don’t think it’s related to the upload process, but to the media grid previewing in SVG.
    The SVGs i’m using have a lot of data in them (complex tables with text as curves). This alone is perhaps responsible for the poor performance once the media library is open, hence my question about using raster images in the preview.

    Plugin Author Benbodhi

    (@benbodhi)

    Right, I know what you mean. WordPress didn’t support SVG at all, and those filters did indeed work until the 4.7.1 release. I remember very clearly as I had to change my code too.
    Basically they changed the way uploads were handled and it messed with lots of file types that were added through custom mime type filtering.

    Ok, so still the best way to test is to cut back to just my plugin and twentyseventeen to see if the media library loads quickly then.

    Maybe you could zip up all the SVG files you’re using and send me a link to download so I can test?

    Either way, I know you said you’re busy. No rush on my part, happy to help when you’re ready ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Media library raster image preview’ is closed to new replies.