[MarkLogic Dev General] What's the best way to extract and store an image fmor XHTML into a binary file that can be accessed separately as an image?

Tim tim at aaom.net
Fri May 3 15:57:59 PDT 2013


Thank s Mike,

How do I know what image type it is if it specified as image/* and not
image/gif?

I need to name it by some extension, eh?

Tim

-----Original Message-----
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Michael
Blakeley
Sent: Friday, May 03, 2013 5:39 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] What's the best way to extract and
store an image fmor XHTML into a binary file that can be accessed separately
as an image?

let $img := <img
src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAA
AIBRAA7"/>
return binary {
  xs:hexBinary(
    xs:base64Binary(
      substring-after(
        $img/@src,
        ';base64,'))) }

-- Mike

On 3 May 2013, at 13:43 , "Tim" <tim at aaom.net> wrote:

> Hi Folks,
> 
> I have images embedded in an xhtml file that I want to extract from 
> the XHTML, store in a spate file in MarkLogic, and then change the 
> XHTML to reference the image where it has been stored.  The biggest 
> hurdle is extracting the image.  For example, the image is currently 
> located in the xhtml as follows:
> 
> <span style="height:4.3256in;width:5.2201in; padding:0; " class="fr1"
> id="Picture_1"><img style="height:10.987cm;width:13.2591cm;" alt=""
> src="data:image/*;base64,iVBORw0KGgoA... "/></span>
> 
> Thanks!
> 
> Tim Meagher
> 
> 
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
> 

_______________________________________________
General mailing list
General at developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general



More information about the General mailing list