I am lazy, so I would let the browser sort it out. That's what cq does, when 
the query result is a binary node. Any modern browser has pretty good 
autodetection for unknown images. Looking at the first several bytes is usually 
enough.

-- Mike

On 3 May 2013, at 15:57 , "Tim" <[email protected]> wrote:

> 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: [email protected]
> [mailto:[email protected]] 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" <[email protected]> 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
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
>> 
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> 

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to