Forum for discussing general topics related to Couch.
10 posts Page 1 of 1
Just trying out CouchCMS for the first time to rework my portfolio website - Wordpress is overkill for what I'm trying to achieve, so I'm looking for another solution. So far, I'm loving CouchCMS but there's one thing that's bugging me: is there any way to upload SVG images with the <cms:editable type="img" /> tag? I get an invalid file type error.

The majority of images on my site are SVG, and I'd prefer to keep it that way - anyone have a solution?
Hello and welcome :)

Please try editing 'couch/includes/fileuploader/config.php' file - find the following directive
Code: Select all
$Config['AllowedExtensions']['File']
and add 'svg' to the list of file extensions.

Alternatively, you may try using the newer version of the fileuploader - viewtopic.php?f=6&t=7712

Hope this helps.
I've tried to add 'svg' into both "$Config['AllowedExtensions']['File']" and "$Config['AllowedExtensions']['Image']", but it is still unable to upload svg image file, the light box "Attention: home_program-rumah.svg: Unknown image format/encoding." keeps showing everytime I try to upload it.

NB: I've also just installed KCFinder 2.51 as well to keep it updated, and I thought it was gonna make it work.
@Herza, KCFinder considers only gif, jpg, jpeg, png, bmp and xbm as valid image types. All other types will be rejected as GD library won't be able to process those as images.

You'll have to use type 'file' editable region to upload the svg files as simple files.

Hope this helps.
Thanks, KK. Having it as type="file" makes it work. I can upload it at least, no need some particular image treatment, though. Thanks a lot, KK! :D
You are welcome :)
Hello KK,

i get denied file extension even after editing the fileuploader config file and changing field type from 'image' to 'file' as advised above.
@harrym, it is the 'couch\includes\kcfinder\config.php' file that needs editing.

Couch v2.0 already has .svg as an acceptable extension so if you are using the older version of Couch, to make things a little easier for you I am attaching the config file taken from v2.0. It will work with 1.4 too so please just extract the file and place it in the ''couch\includes\kcfinder\' folder this replacing the existing file.

Hope it helps.

Attachments

How do I display an SVG image as an img file?

I've uploaded it as a file but the path is not recognisable? src(Unknown)?
markjeater wrote: How do I display an SVG image as an img file?

I've uploaded it as a file but the path is not recognisable? src(Unknown)?


Do you mean on the front end to display it as image, if so the following should work

On back end
Code: Select all
<cms:editable
  name='my_svg'
  label='Upload SVG file'
  desc='Upload the svg file here'
  type='file'
/>


Code: Select all
<img src="<cms:show my_svg' />"


If on the back end, it won't show as a image as it's a file type and can't use image type as it don't allow svg files to be uploaded

Hope that helps
10 posts Page 1 of 1