Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to upload SVG images for categories #3064

Closed
mudgie opened this issue May 30, 2015 · 4 comments
Closed

Unable to upload SVG images for categories #3064

mudgie opened this issue May 30, 2015 · 4 comments

Comments

@mudgie
Copy link

mudgie commented May 30, 2015

Using OpenCart 2.0.1.1, I receive the following error when attempting to upload an SVG image as a product category image:
2015-05-30 19_47_33

SVGs are allowed in 'Allowed File Extensions' and 'Allowed File Mime Types' within the Server options (I have not modified this from the default installation):
2015-05-30 19_52_14

I've double checked that the MIME type of my SVG image is image/svg+xml.

@danijelGombac
Copy link
Contributor

Look in filemanager.php at line: 234 and 245

Settings has nothing to do with the upload in filemanager.

@mudgie
Copy link
Author

mudgie commented May 30, 2015

I did look into this a bit further and did find those lines in filemanager.php. I've added 'svg' and 'image/svg+xml' to the $allowed array, however, it goes a bit deeper than that. Doing this allowed the uploading of SVGs however the images don't display in the admin panel properly.

I assume that the image resizing is failing because it's not a file type that OpenCart supports properly, so to work around the issue I'm modifying template files such as \admin\view\template\common\filemanager.tpl and \admin\view\template\catalog\category_form.tpl with code like:

As it doesn't copy the SVG to /image/cache/catalog/ with '-100x100' in the file name, I'm simply removing those parts so the image path is legitimate.

I know that this isn't the most ideal way to work around the issue, however I'm not very familiar with how OpenCart is put together.

@danielkerr
Copy link
Member

svg is not the same as jpg, png so no it wont work and its not a bug!

@GomDani dont give advise unless you know what you are doing.

@mudgie
Copy link
Author

mudgie commented Jun 1, 2015

Hi Daniel, I understand if this isn't considered a bug, but given that SVGs are important for mobile design on devices with retina displays, could this perhaps be a feature request for a future release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants