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

feat: Implement dataUri function for SVG generation #1035

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

VishnuSrivatsava
Copy link

Description

This PR implements the dataUri function, which generates a random data URI containing either a URL-encoded SVG image or a Base64-encoded SVG image. It includes options for width, height, color, and type.

Reason for Changes

This feature allows users to easily generate SVG images in a data URI format, which is useful for embedding images directly in HTML.

Testing

I added unit tests for the dataUri function to ensure it generates valid SVG and Base64 URIs. All tests pass successfully.

Related Issues

Fixes #1024: add dataUri function to Image module

Additional Notes

Currently, the function only supports basic colors. Future work could include support for gradients.

Comment on lines +26 to +28
src/modules/image.cpp
src/modules/base64.cpp
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they shouldnt be added here (in main Cmakelists), but in src's Cmakelists (https://github.com/cieslarmichal/faker-cxx/blob/main/src/CMakeLists.txt)

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.

add dataUri function to Image module
2 participants