Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

upload an image in confluence

Vidya Shevale November 14, 2018

Hello Team,

I am writing a script to read all directories and files and posting it to confluence.For that I am using confluence server rest API's.

I have created page tree structure also created a html pages as a page , I am able to see other html content but not able to see the images.

Images are located in same or different folders depends on directory structure

below is my image tag in html file

<IMG USEMAP="#map1" src="PROPRO001_ReceiveDryGoods.jpg"/>

I have already attached the image in folder but not able to link here

//Read File content
$content = file_get_contents($fileName);

//ro remove script and style from page
$content = preg_replace('#<style(.*?)>(.*?)</style>#is', '', $content);
$html = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $content);

//find all BODY with JS and CSS tags and replace with only BODY tag

if (strpos($html, '<BODY ONUNLOAD="javascript&colon;dounload();" LINK="#0000ff" VLINK="#800080">') !== false){
$html = str_replace('<BODY ONUNLOAD="javascript&colon;dounload();" LINK="#0000ff" VLINK="#800080">',"<BODY>", $html);
}

if (strpos($html,'<BODY ONUNLOAD="javascript&colon;dounload();">') !== false) {
$html = str_replace('<BODY ONUNLOAD="javascript&colon;dounload();">',"<BODY>", $html);
}

//Get body content from Html file
$bodyContent = get_string_between($html, '<BODY>', '</BODY>');

//replace & with &amp; quotes
$content = str_replace('&','&amp;', $bodyContent);

// remove line breaks and whitespace
$content = preg_replace('/[ \t]+/', ' ', preg_replace('/[\r\n]+/', "\n", $content));

create_page($fileName , $parentID ,$content ,$varContain ,$level);

 

this is my code to get html content, Please help me as soon as possible.

Thanks and Regards

Vidya Shevale 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events