We have a REST API GET call that appears to not return anything if the
document being returned is greater than a 1 MB or so.
The document expected is actually a JPG image and the REST API resource
extension code looks like this :
*declare function **local:get-resized-image* (*$image_server_root*, *$uri*,
*$width*, *$height*) {
*let **$resized_uri* := *fn:concat*(*fn:substring-before*(
*$uri*,".jpg"),"_",*$width*,"_",*$height*,".jpg")
*let* *$resized_image* := *if* (*xdmp:uri-is-file*(
*$resized_uri*)) *then *
*fn:doc*(*$resized_uri*)
*else *
*let **$image* := *fn:doc*(
*$uri*)/*node*()
*let* *$image_name* := *fn:tokenize*
(*$uri*,"/")[*last*()]
*let* *$url* := *fn:concat*(
*$image_server_root*,"/",*$width*,"/",*$height*,"/",*$image_name*,
"?resized_uri=",*$resized_uri*)
*let* *$temp_image* :=
*xdmp:http-put*(*$url*, (), *$image*)[2]
*let* *$_* := *xdmp:document-insert*
(*$resized_uri*,*$temp_image*,*xdmp:default-permissions*())
*return **$temp_image*
*return document*{*$resized_image*}
};
*declare* %rapi:transaction-mode("update") *function*
*local:get*(*$context* *as
**map:map*, *$params* *as **map:map*) *as **document-node*()*
{
*let **$image_server_root* := "
http://solrdev1.dom1.mycomp.org:7000/resize_image"
*let* *$uri* := *map:get*(*$params*,"uri")
*let* *$width* := *map:get*(*$params*,"width")
*let* *$height* := *map:get*(*$params*,"height")
*let* *$caller* := *map:get*(*$params*, "caller")
*let* *$xml-uri* := *fn:replace*(*$uri*, "\.(\w+)\s*$",
".xml")
*let* *$xml-doc* := *fn:doc*(*$xml-uri*)
*let* *$xml-published* := *fn:data*(*$xml-doc*/*image_challenge*/
*@published*)
*return*
*switch* (*$caller*)
*case *"external" *return*
*if* (*$xml-published* = "true") *then*
*let **$mime_type* := *map:put*(
*$context*,"output-types","image/jpeg")
*return*
*local:get-resized-image*(
*$image_server_root*, *$uri*, *$width*, *$height*)
*else*
*document* {()}
*case *"internal" *return*
*let **$mime_type* := *map:put*(*$context*,
"output-types","image/jpeg")
*return*
*local:get-resized-image*(
*$image_server_root*, *$uri*, *$width*, *$height*)
*default* *return *
*document*{()}
};
I'm able to verify that our solrdev1 server was able to generate the
resized image and that it got saved in ML.
The only problem we have is that the image document isn't getting returned
by this GET call when it's bigger than 1 MB.
Is there a config I need to change somewhere ?
Regards,
Danny
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general