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

add support for inline images - add images dynamicaly into a text frame #213

Open
flagadur opened this issue Jun 12, 2023 · 4 comments
Open

Comments

@flagadur
Copy link

It would be super awesome to insert images into text frame dynamically. I don't think it's possible yet, is it? Thanks ;)

Example :
My Text_Frame : "%VAR_my_text%
my_text : "Inflict 3 %VAR_image_for_damage% to the target %VAR_image_for_creature%

@berteh
Copy link
Owner

berteh commented Jun 12, 2023

It is perfectly feasible... and was actually one of my reasons to develop the tool, just not in a single dynamic text but between multiple dynamic texts (that can all be inserted in a single text frame, in sequence).

Since variables (text or images) that would be empty after the substitution are removed by ScribusGenerator you should be able to get the expected result.

To take your example I'd cut the data somewhere along the table below, and design the Scribus template accordingly while playing with the anchor of the image frames so that it keeps aligned with the preceding character. Empty texts and images placeholders will be remove when empty, no worry there.

text1 img12 text2 img23 text3 img34 text4
Inflict 3 ./pic/dmg-inline.png to the target ./pic/creature/basilik-inline.png
Inflict 1 ./pic/dmg-inline.png to every ./pic/creature/blue.png creature in the oponent field.
Recover 3 ./pic/health-inline.png and add 2 ./pic/defence-inline.png tokens to all your ./pic/creature/purple.png creatures

@flagadur
Copy link
Author

flagadur commented Jun 12, 2023

Yayyy ! Thanks for the tips!

I don't know how to "play with anchors" though...
I tried inline objectifs but it doesn't seem to work with Scribus Generator substitution : https://www.youtube.com/watch?v=8bdQNEVEtDo&ab_channel=GraphicdesignforFree

@berteh
Copy link
Owner

berteh commented Jun 12, 2023

you're right. the "inline" object didn't exist yet so I played with absolute positionning and text alignement (right align for text left of the image, for instance) to mimic some inline.

It should be possible to adapt the SG code to handle inline objects without too much work, will have a look but I don't exactly know when... if you wanna give it a shot feel free to hack the code and submit a pull request.

@flagadur
Copy link
Author

So this way you can only add one image into a text but it's a start!
I'm afraid I'm not skilled enough to improve your code... I would love to though.
If you had some time for it, it would be awesome, but if not no worries, your project is fabulous.
It's my day to day tool for work ;)
If you need some sample projects to share new people with, don't hesitate to ask!

@berteh berteh changed the title Is it possible to add images dynamicaly into a text frame? add support for inline images - add images dynamicaly into a text frame Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants