diff --git a/include/hyprgraphics/image/Image.hpp b/include/hyprgraphics/image/Image.hpp index 875dbc9..2fa2902 100644 --- a/include/hyprgraphics/image/Image.hpp +++ b/include/hyprgraphics/image/Image.hpp @@ -37,6 +37,8 @@ namespace Hyprgraphics { Hyprutils::Memory::CSharedPointer cairoSurface(); + static bool isImageFile(const std::string& path); + private: std::string lastError, filepath, mime; Hyprutils::Math::Vector2D m_svgSize; diff --git a/src/image/Image.cpp b/src/image/Image.cpp index 9c2985a..96853f0 100644 --- a/src/image/Image.cpp +++ b/src/image/Image.cpp @@ -123,3 +123,12 @@ Hyprutils::Memory::CSharedPointer Hyprgraphics::CImage::cairoSurf std::string Hyprgraphics::CImage::getMime() { return mime; } + +bool Hyprgraphics::CImage::isImageFile(const std::string& path) { + bool result; + { + CImage test(path); + result = test.success(); + } // test destroyed here, memory freed + return result; +}