Image Type: SVG

3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 22, 2016   (RSS)

By Toledoh - August 17, 2016

Hey Guys.

Can we get SVG added to the image type in the uploads field? I manually add it, but I would like to be able to display a thumbnail in the admin in exactly the same way that a jpg is show - rather than showing as "download".

Cheers,

Tim (toledoh.com.au)

By Daryl - August 22, 2016

Hi Tim,

We'll look into adding support for SVG image file type for the next release. 

You can add the following patch, for now, to display the thumbnails for SVG images in the admin.

In showUploadPreview function in \cmsb\lib\upload_functions.php file, add the following code after line 1086:

$isImage = preg_match("/\.(gif|jpg|jpeg|png)$/i", $uploadRecord['urlPath']); // line 1086

// display image preview for svg image file type
if (preg_match("/\.(svg)$/i", $uploadRecord['urlPath'])) {
  $isImage                = true;
  $uploadRecord['width']  = "150";
  $uploadRecord['height'] = "150";
}

Note: This patch is for v3.05 and don't forget to create a backup first

Let me know any questions.

Thanks,

Daryl Maximo
PHP Programmer - interactivetools.com

By Toledoh - August 22, 2016

Thats great - Thanks Daryl.

Cheers,

Tim (toledoh.com.au)