cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
StuPower
Helper I
Helper I

Converting HTML to JPG Query

Hello

 

I'm trying to convert a piece of HTML to a JPG file that contains two images but no matter what I try the best I can get is one of the images showing. If I convert it to a PDF I get one image then a slither of the second image further down. If I save and view the HTML file its exactly as I want.

 

The HTML is as follows:

 

 

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<img src="Image1" style="position:fixed; left:0px; top:0px;"/>
<img src="Image2" style="position:fixed; left:175px; top:101px; width:440px; height:306px;"/>
</body>

 

 

"Image1" and "Image2" I'm getting from OneDrive then converting to Base64 using the DataURI then I'm composing the HTML

 

Any ideas?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-litu-msft
Community Support
Community Support

Hi @StuPower,

 

I am afraid that combine multiple images into one image is impossible in Flow.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
v-litu-msft
Community Support
Community Support

Hi @StuPower,

 

You could refer to these steps to store these images in HTML into SharePoint:

1. use Split() function to split these code by using blank ' ' as the separator, then use Filter array to filter out members contains "src=".

2. use replace function to remove "src=" and double quotes

3. use dataUriToBinary() function convert the dataUri to binary.

4. Create file. Please make sure the file name not the same, or the image just has only one could create.
Screenshot 2020-12-08 145638.jpg

 

Screenshot 2020-12-08 151649.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

StuPower
Helper I
Helper I

@v-litu-msft 

 

Hello, thanks for your help

 

In compose 2 are you still inputting the datauri from the "get file" as your two outputs?

 

What is your "Item" in the filter array I'm not getting that option?

 

Compose 4 is a bit hard to read with the image quality, is that- 

 

dataUriToBinary(replace(replace(item(),'src=',"),"","))

 

I'm not sure where "item" is coming from

 

Thanks

 

 

v-litu-msft
Community Support
Community Support

Hi @StuPower,

 

1. I still input two src, just reproduce your instance.

2. the item is input manually:

Screenshot 2020-12-08 170548.jpg

 

3. the expression is:

dataUriToBinary(replace(replace(item(),'src=',''),'"',''))

 the third parameter in the replace() function is ' ', there is a blank space in it.

The item() means the current item in the loop, for more details, please refer to this document:

Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-litu-msft 

 

Thanks for the clarification. This is now working but is creating two image files

 

I'm trying to create one image file with both images in it

v-litu-msft
Community Support
Community Support

Hi @StuPower,

 

I am afraid that combine multiple images into one image is impossible in Flow.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @StuPower 

 

I have a flow that creates an HTML file from a Powerapps HMTLText control. 

 

I then add 2 images to the top and bottom using Flow. So I first do 2 x Get File Content from Sp Doc Library and then create variables for both using dataURI.

 

I then do a Concat to add both images before and after the HMTLText content to create the file. 

 

I then convert the HTML file to JPG. this creates a JPG with both images and the HTMLText.

 

I can't add screenshots. Will try a bit later to upload images from Chrome.

 

Let me know if you need more info.

 

Cheers

 

Fransk

 

@fransk I would be very interested in seeing the screenshot, thanks

Hi Stu, 

 

Did you ever get this working? Im tying something similar just now and having no luck

No afraid not

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,728)