Pinegrow Plugin not showing or inserting SVGs correctly

Running Pinegrow Plugin 1.0.2 and 1.0.4 (I haven’t tested other versions) on both my dev server and on LocalWP, I’m having trouble inserting an SVG from the media library into an IMG element. The first sign of trouble is in the insert menu, where SVGs aren’t displaying.

Then, when I look at the code, I see that the path isn’t inserted correctly.

Output from the console: (On one line it looks like it’s trying to pull the SVG image from the root of my uploads folder)

https://pinegrow.peakperformance.dev/wp-content/uploads/logoipsum-logo-6.svg

Correcting the path manually in the code editor works as expected.

Hello there, well, haven’t you been a busy bee? I guess your bored with Xmas already and moved on :smiley:
anyway, humour aside , I’ve just noticed a bit of a similarity in a couple of bug reports (which are somewhat out of my depth) but just wondering, do You think this is in part due to this other, somewhat similar bug report?

Im not sure if any theme importing etc was implemented by your good self (I’d have thought not but… )

Wordpress, images expected to be in the root for some reason? I was just wondering if @Emmanuel’s findings would clarify the behaviour you’ve noticed… in this one of several in your flurry of bug reports.
Good stuff :smiley:
more grist for the mill <3

Haha, I’m a Scrooge through and through. Besides, I have a few tight deadlines and a busy family week so I’m trying to squeeze in work wherever I can.

The reports I submitted have nothing to do with the post you linked. I’m not using the Plugin for this project and all the issues were just part of the regular builder functionality. I just happened to see this problem while I was verifying one of the other issues I submitted.

And don’t get tripped up by Emmanuel’s language on that linked article. He wasn’t really saying anything about the root directory, he was just saying that images from a desktop project would be imported into the WP media library but that they wouldn’t be viewable in the project directories like we see on the desktop. Basically, It’s working as designed.

As far as I can tell, the reports I submitted are all minor UI issues since I can work around them by modifying the HTML directly.

1 Like

Not just in this article, in general too!!!
Because english is not my native language, sometimes (often?) I can mess up on some expressions :wink:

1 Like

@adamslowe how are you uploading SVG images? Which “Allow SVG” plugin are you using on the site?

I tried SVG Support – WordPress plugin | WordPress.org on my server and LocalWP. I did it by importing a project with SVGs and by uploading them first.

I’m pretty sure I also tested with ShortPixel’s plug-in but don’t remember specifics now. WP SVG Images – WordPress plugin | WordPress.org

I’ll test again and do a loom video when I’m back at a computer.

@matjaz Here is a Loom showing the behavior with both the SVG Support – WordPress plugin | WordPress.org plugin and the WP SVG Images – WordPress plugin | WordPress.org plugin. The behaviors are slightly different for each one. In both tests I manually uploaded the files and created new Pinegrow projects to simplify it so you can try to reproduce it on your end.

WP SVG Images:

  • I don’t see the SVG previews in the Pinegrow media browser
  • I don’t see the media sizes in the PG media browser
  • When you add the SVG via Pinegrow, the path is /wp-content/uploads//

SVG Support

  • I don’t see the SVG previews in the Pinegrow media browser
  • I DO see the media sizes in the PG media browser
  • When you add the SVG via Pinegrow, the path is /wp-content/uploads/./filename.svg


Pinegrow WP SVG Tests - Watch Video

Silly question, but have you tried dispensing with the plugins altogether and just adding basic svg support via php?

I’m paranoid and want the sanitization features in the plugins. But yes, I’ll give that a try next.

Oh I do get the paranoia aspect.

Thanks for the nudge to test with a generic function. I used the code below and it exhibited the same behavior as the “WP SVG Images” plugin, unfortunately.

function enable_svg_upload( $upload_mimes ) {
    $upload_mimes['svg'] = 'image/svg+xml';
    $upload_mimes['svgz'] = 'image/svg+xml';
    return $upload_mimes;
}
add_filter( 'upload_mimes', 'enable_svg_upload', 10, 1 );

That does rather suggest that there is something else at play here.

Thanks @adamslowe @Dom this has been addressed in 1.0.6. Re-uploading SVGs might be needed.

Matjaz is a lean, mean, bug-fighting machine.

Don’t worry though, I’ll find more for you :grin:

2 Likes

Blinking heck!
Ive only just dowloaded and installed 1.0.5 !

Not even ran it yet… this is a rather industrial phase in the PG History…

3 Likes

@matjaz I can’t export blocks made with Pinegrow desktop (7.05) that contains svg. I have a plugin for svg support to no avail.

Do you get any sort of error in Pinegrow or WordPress? I just created some blocks yesterday with in-line SVG and linked svg files with no problem using desktop 7.05.

No errors or anything.

Just blocks that contain any svg dont register in gutenberg.

Removing the svg and re-exporting, then blocks gets registered and can be used. Obviously without svg though…

Silly question… have you tried a different SVG to see if there is something weird with the one you are using? I know for a fact that the Facebook, Twitter, Instagram, and TikTok icons from Remix work (that’s the block I just made yesterday)

Remix Icon - Open source icon library

1 Like

Yes maybe. I will check the svg code and I will try some hours later today and let you know.