Support » Plugin: Import Products from any XML or CSV to WooCommerce » .Svg images not loading

  • Resolved Kosmostarfild

    (@kosmostarfild)


    Hello!
    I have activated the loading of images of the .svg type in my WordPress and in manual mode they are normally loaded into the media, however, when you start importing your plugin, this type of images is for some reason ignored. Please tell me how to make the .svg import successfully from the csv file?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor WP All Import

    (@wpallimport)

    Hi @kosmostarfild,

    You will need to add this code to your child themes functions.php file to enable SVG support in WP All Import:

    add_filter('wp_all_import_image_mime_type', 'wpai_image_mime_type', 10, 2);
    
    function wpai_image_mime_type($mime_type, $image_filepath) {
      if (empty($mime_type) and preg_match('%\W(svg)$%i', basename($image_filepath))) {
        return 'image/svg+xml';
      }
      return $mime_type;
    }
    Thread Starter Kosmostarfild

    (@kosmostarfild)

    Added your code to the theme’s functions.php, but still images are not saved in the gallery. In manual mode add svg to the gallery is obtained.

    Logs:

    WARNING: File https://site.com/campaign/images/2021/4/9/16409-ae89359b75b6ac41.svg is not a valid image and cannot be set as featured one
    
    [18:45:18] - Searching for existing image <code>https://site.com/campaign/images/2021/4/9/16409-ae89359b75b6ac41.svg</code> by <code>_wp_attached_file</code> <code>16409-ae89359b75b6ac41.svg</code>...
    
    [18:45:18] - Searching for existing image <code>/var/www/u24587964/data/www/site2.com/wp-content/uploads/wpallimport/files/https://site.com/campaign/images/2021/4/9/16409-ae89359b75b6ac41.svg</code> in <code>/var/www/u24587964/data/www/site2.com/wp-content/uploads/wpallimport/files/</code> folder
    • This reply was modified 4 months, 3 weeks ago by Kosmostarfild.
    Plugin Contributor WP All Import

    (@wpallimport)

    Hi @kosmostarfild,

    In that case, we’ll have to run tests with your import data to understand what’s going on. Please replicate the issue on a sandbox site at http://www.wpallimport.com/debug/, then open a support request at http://www.wpallimport.com/support/ with the sandbox site URL and a brief description of the problem.

    Thread Starter Kosmostarfild

    (@kosmostarfild)

    Thank you! The problem was solved by updating your plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.