Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Using Base64 Embedded Images in HTML

Hey I'm working on uploading html files to Confluence (this is done through the API). Originally the plan was to only use text (which we got working great), but now we need to include pictures as well. We decided to either A: attach the pictures first, and then push the html after we put the correct paths in the html or B: Encode the pictures as Base64 and then just push html.

I've been working on B, the Base64 portion, whenever I go to the Source Editor and paste an html file with Base64 instead of Confluence leaving it as Base64, it decides to convert the Base64 to an attachment. It then deletes my entire html information, and only has the first Base64 picture. Is there any way for it to leave my Base64 alone? I'd rather have an embedded picture than a attachment one. It also is much easier to do B rather than A.

 

 

 

 

1 answer

When you say "Base64 portion", are you talking about images with data: URIs as their source, e.g. <img src="data&colon;image/png;base64,...">

If so, I have encountered the same bug.

https://community.atlassian.com/t5/Confluence-discussions/WYSIWYG-editor-accepts-HTML-with-embedded-images-but-doesn-t/m-p/776355#M1716

Yes that is exactly what I was talking about. I did find a solution that at least worked for me. Here it is.

Originally I was trying to paste straight HTML into the Source Editor. This would ruin the way the pictures and html was set up. What I instead starting doing was using the HTML Macro. If I inserted my HTML Code into the HTML Macro than everything displayed correctly. The Macro essentially just adds these lines into the source editor before and after where your code will go.

<p class="auto-cursor-target">
  <br/>
</p>
<ac:structured-macro ac:macro-id="fae243f8-1d98-45f9-a52c-4ba0a140fb71" ac:name="html" ac:schema-version="1"/>
*** Your code goes here ***
<p class="auto-cursor-target">
  <br/>
</p>

This way now I can push about 10 pages to Confluence per second just by pushing HTML.

Let me know if you have any more questions about what I did.

Like # people like this

Thanks. That's quite interesting. So if the HTML including data: URIs is wrapped in the HTML macro… it works.

Probably this is because Confluence is applying some additional parsing and reformatting to HTML not wrapped in this macro, and it gets confused by data: URIs.

Unfortunately, I'm not using the API… I'm trying to allow my users to copy-and-paste the HTML / rich text directly into the WYSIWYG editor window. So I don't think I can use your solution for now, but it's good to know about.

@Slade Jeppesen I would LOVE more information on how you're working this particular bit of Santeria. I'm attempting to do something similar, and keep getting (fairly epic) fails. Any chance you'd share some pointers? Or even a code snippet?

 

Feel free to hit me directly if you prefer: Nerdy.Deeds (at) done (dot) cheap

Hi Team,

 

<p class="auto-cursor-target">
  <br/>
</p>
<ac:structured-macro ac:macro-id="fae243f8-1d98-45f9-a52c-4ba0a140fb71" ac:name="html" ac:schema-version="1"/>
*** Your code goes here ***
<p class="auto-cursor-target">
  <br/>
</p>

 

This code is working for conflence server or confluence cloud please let me know.

Thanks-Chandrasekhar.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

Introducing Confluence Cloud for Microsoft Teams (Available for Preview!)

Hi Atlassian Community, Remote work has shifted how teams collaborate, and we’ve heard from many of you that Microsoft Teams has become mission critical to many of your workflows, from how you chat...

2,601 views 21 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you