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

Glide does handle unsupported file formats. #2122

Closed
wants to merge 3 commits into from
Closed

Glide does handle unsupported file formats. #2122

wants to merge 3 commits into from

Conversation

jonassiewertsen
Copy link
Contributor

Glide is a great tool to resize images, but can't handle some file formats like SVG files. It does make sense. Why would you want to resize a SVG image?

This PR does make it possible to pass any kind of image to glide. Should a specific format be not supported, glide will return the original path and the image would be shown in every case.

A common use case will make this more clear.

Until now you would check if fx an SVG is among the images.

{{ customers }}
    {{ if logo:extension !== "svg" }}
        <img src="{{ glide:logo width='165' quality='100' }}">
    {{ else }}
        <img src="{{ logo }}">
    {{ /if }}
{{ /customers }}

The same result if this PR gets approved

{{ customers }}
    <img src="{{ glide:logo width='165' quality='100' }}">
{{ /customers }}

The SVG format is not supported, so the original path would be returned.

@jasonvarga I am not sure about the Exception.

Glide is a great tool to resize images, but can't handle some file formats like SVG files. It does make sense. Why would you want to resize a SVG image?

This PR does make it possible to pass any kind of image to glide. Should a specific format be not supported, glide will return the original path and the image would be shown in every case. 

A common use case will make this more clear. 
```
// Instead of 
{{ customers }}
    {{ if logo:extension !== "svg" }}
        <img src="{{ glide:logo width='165' quality='100' }}">
    {{ else }}
        <img src="{{ logo }}">
    {{ /if }}
{{ /customers }}

// You can do
{{ customers }}
    <img src="{{ glide:logo width='165' quality='100' }}">
{{ /customers }}
```
@jonassiewertsen jonassiewertsen changed the title Glide does handle unsported file formats. Glide does handle unsupported file formats. Jul 22, 2020
@andjsch
Copy link
Contributor

andjsch commented Jul 23, 2020

This is probably one of the most useful enhancements that V3 is missing right now ❤️

jasonvarga added a commit that referenced this pull request Sep 7, 2020
@jasonvarga
Copy link
Member

jasonvarga commented Sep 7, 2020

Merged via 8a9f445, thanks Jonas!

@jasonvarga jasonvarga closed this Sep 7, 2020
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

Successfully merging this pull request may close these issues.

3 participants