Using Mule - Datawave want to download all Images in HTML - mule-studio

I have a situation, where I need to download all images added (URL) in HTML, using Datawave.
Example : Here is my HTML received in payload
<div class="Container"> \n\n
<img src="https://test.documentforce.com/servlet/rtaImage?eid=ka0000000id01&feoid=00aF000002MA1&refid=0BR5w000001mnlq" alt="">
<div>...</div>\n\n
<img src="https://test.documentforce.com/servlet/rtaImage?eid=ka0000000id02&feoid=00aF000002GE2&refid=0BR5w000001hh2u" alt="">\n\n
</div>
Can you give me some sample code which go through the HTML and download all actual images instead of URL's

You can use readUrl with content-type as application/octet-stream, though it would give you a stream of bytes. What you can do is extract the content of the url and then do a file read, something akin to what's been described here

Related

Display image in email body

I am trying to display an image in powershell email body
tried below
$body = #"
Hi Team,
Please find the attached report
Note: To view the Index page, please click on Enable editing option in excel
<html>
<body style="font-family:calibri">
<img src='cid:enable_editing.png'>
</body>
</html>
Thank you
***This is an auto-generated email. Please do not respond***
"#
There are 2 excel attachment which goes with the email.
Please let me know how to display that
When I am sending the image as attachment and making -BodyAsHTML, I am loosing the email formatting
Naturally with -BodyAsHTML your text would need to be part of the HTML and naturally you'd need to use HTML linebreaks to well ... have linebreaks. Your whole body needs to be HTML.
So for example you'd have something like:
<html><body>
<p>Hi Team,</p>
<p>Please find the attached report. <br/> To view it to X.</p>
<img ... />
</body></html>
Beware that HTML formating is usually limited within mail clients. Not every tag and CSS format will work.

Where is the error in tag(a)?

this is my first year in html courses, i'm using HTML 4.01 Strict/XHTML 1.1
Where is the error in this code??
<a href="http://www.upv.es" onclick="target='_blank';">
<img src="http://politube.upv.es/templates/imagenes_cabecera/escudo.gif"/>
</a>
Well, you don't provide us with information about what you expect and what is not working. If you try to open the link in a new Tab, you'll have to change
onclick="target='_blank';"
to
target="_blank"
Otherwise, you'll be just setting a JavaScript variable target to the string value _blank.

Laravel: How to embed image in an email as a content and not as an attachment

I have searched for ways to embed an image in an email sent with Laravel. The method I have found which most people use is to embed the image as an attachment.
<img src="{{$message->embed(asset('assets/img/logo.png'))}}" style="padding:0px; margin:0px" />
Is there a way to embed an image without it being an attachment? I tried converting the image to base64 strings but that didn't even work.
Whether its a good thing or not...
You nearly have it. I suppose the problem is that the asset() function is generating a full url and Laravel need the path to the file. Official Doc
Try this:
<img src="{{ $message->embed('assets/img/logo.png') }}" style="padding:0px; margin:0px" />
You need specify full path so,
<img src='{{ $message->embed(public_path().'/img/image.jpg') }}'>

RESTful way of File Uploading

I want to implement file upload in RESTful way using openrasta but not able to find proper way to implement it.There are few ways like using Ajax file upload or using Iframe which i could find.
Can anybody suggest any way of doing this or provide me some resources from where i can refer.
Thanks in advance
It seems to me you're trying to build file uploading in an html environment.
You have two choices.
Use an HTML form to upload the file.
<form enctype="multipart/form-data" action="/files" method="post">
<fieldset>
<input type="file" name="filename" />
<input type="submit" />
</fieldset>
</form>
You can map that in OR very easily. Your handler would look like this:
public object Post(IFile filename) { /* do something with the file */ }
You can't do ajax-based file upload with progress bars as there is no way in pure xmlhttprequest to manipulate binary files. If you go down the route of using a flash / silverlight control behind the scene, you'll just need to make sure you post the content of the file to /files as in the previous example, the easiest way being to send the content with a Content-Type http header of application/octet-stram, and the same handler code will just work.

Perl see the full content in response

I need to take data from html page, so I am using LWP to get the page content.
the response I got is partial and not the full source of the page.
...
<div style="display:none" id="QUERY" query=""></div>
<div style="display:none" id="COLL" idcoll=""></div>
<div style="display:none" id="BROWSE" field=""></div>
<div id="center"></div>
<div id="loading"></div>
...
when using a web debugger(FIRE BUG) I can see a hidden content under:
<div id="center"></div>
<div id="loading"></div>
How can I get the hidden data using Perl ?
It breaks my mind for 3 days now !
Thanks ahead.
let's say it a JS running... How can i
see the content?
You could use WWW::Mechanize::Firefox. It seems to support Javascript.
If the content is indeed added using Javascript, you might be able to use WWW::Scripter with the Javascript or Ajax plugin.
If it is not present in the HTML source that LWP fetches, it is added in some other way. There probably is a Javascript running, or the webserver serves you and LWP different pages because of cookies or user agent string.
Install Firebug or use the Safari Develop menu to see what AJAX/XHR requests are being done to the server, and with what POST/GET parameters. You can then use LWP or any other HTTP client module to do such a request.