WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org
View all threadsHi,
I have reviewed the Talk archive about how to get a media image into a Jasper report. Is there any newer documentation about this?
I saw these two:
I have been trying to use the second method and would like to share my unsuccessful result and ask for suggestions. Thanks, Willi
(I've obscured the server and tenant values. )
http://server:8180/cspace/tenant/view/blobs/537ef32f-25c3-4abd-b0f0/content
Or this:
Resulting in this:
<html> <head> <meta charset="UTF-8" /> </head> <body> <div id="cspace"></div> <script src="/cspace-ui/cspaceUI@5.1.3.min.js<mailto:/cspace-ui/cspaceUI@5.1.3.min.js>"></script> <script src="/cspace-ui/cspaceUIPluginProfileFCart@3.0.1.min.js<mailto:/cspace-ui/cspaceUIPluginProfileFCart@3.0.1.min.js>"></script> <script> cspaceUI({ basename: '/cspace/tenant', plugins: [ cspaceUIPluginProfileFCart(), ], prettyUrls: true, tenantId: '10', }); </script> </body> </html>Hi Willi,
I created that fetchimage.php script for the Oakland Museum some years
back. I can share the code I used for this, which is/was running on CSpace
v4.2 (I think). I recommend running this only from localhost and/or
tightening up the code as you see fit. Maybe create a dedicated CSpace user
account that can only read media blobs, and keep account secrets in an env
variable.
The script has been modified a little to only need the blob CSID and a size
format type rather than the entire API endpoint path.
https://gist.github.com/jessemartinez/167465e25cfe72e811e09915c1dacd85
Thanks,
Jesse
On Thu, Mar 4, 2021 at 11:39 AM William Wolf ww@williwolf.net wrote:
Hi,
I have reviewed the Talk archive about how to get a media image into a
Jasper report. Is there any newer documentation about this?
I saw these two:
1. BAMPFA method using a Postgresql function to find the filepath.
This wouldn’t seem to support previewing reports in my Jasper Studio and I
didn’t pursue it.
2. The Oakland Museum method using a csid number in a Jasper parameter
to build a URL to the media blob.
I have been trying to use the second method and would like to share my
unsuccessful result and ask for suggestions. Thanks, Willi
(I’ve obscured the server and tenant values. )
http://server:8180/cspace/tenant/view/blobs/537ef32f-25c3-4abd-b0f0/content
Or this:
Resulting in this:
<html> <head> <meta charset="UTF-8" />
</head>
<body>
<div id="cspace"></div>
<script src="/cspace-ui/cspaceUI@5.1.3.min.js"></script>
<script src="/cspace-ui/cspaceUIPluginProfileFCart@3.0.1.min.js"></
script>
<script>
cspaceUI({
basename: '/cspace/tenant',
plugins: [
cspaceUIPluginProfileFCart(),
],
prettyUrls: *true*,
tenantId: '10',
});
</script>
</body>
</html>
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Hi Willi,
A URL to retrieve an image directly from the REST API for a given media csid would look like these:
https://core.dev.collectionspace.org/cspace-services/media/aead8795-e943-415a-910a/blob/derivatives/Thumbnail/content
https://core.dev.collectionspace.org/cspace-services/media/aead8795-e943-415a-910a/blob/derivatives/Small/content
https://core.dev.collectionspace.org/cspace-services/media/aead8795-e943-415a-910a/blob/derivatives/Medium/content
https://core.dev.collectionspace.org/cspace-services/media/aead8795-e943-415a-910a/blob/derivatives/OriginalJpeg/content
https://core.dev.collectionspace.org/cspace-services/media/aead8795-e943-415a-910a/blob/content
Or, for a given blob csid (stored in the blobCsid field of the media record):
https://core.dev.collectionspace.org/cspace-services/blobs/3163a6bc-7e2b-410f-9d05/derivatives/Thumbnail/content
https://core.dev.collectionspace.org/cspace-services/blobs/3163a6bc-7e2b-410f-9d05/derivatives/Small/content
https://core.dev.collectionspace.org/cspace-services/blobs/3163a6bc-7e2b-410f-9d05/derivatives/Medium/content
https://core.dev.collectionspace.org/cspace-services/blobs/3163a6bc-7e2b-410f-9d05/derivatives/OriginalJpeg/content
https://core.dev.collectionspace.org/cspace-services/blobs/3163a6bc-7e2b-410f-9d05/content
All of those requests require basic auth. Jesse's script is a good place to start. There are also ways to publish blobs so that they are publicly accessible to anyone without credentials, if that's appropriate for your images.
Ray
Ray Lee
CollectionSpace Senior Developer
LYRASIS
ray.lee@lyrasis.org
From: Talk talk-bounces@lists.collectionspace.org on behalf of Jesse Martinez mjesse@gmail.com
Sent: Thursday, March 4, 2021 12:21 PM
To: William Wolf
Cc: talk@lists.collectionspace.org
Subject: Re: [Talk] Jasper report with media image
Hi Willi,
I created that fetchimage.php script for the Oakland Museum some years back. I can share the code I used for this, which is/was running on CSpace v4.2 (I think). I recommend running this only from localhost and/or tightening up the code as you see fit. Maybe create a dedicated CSpace user account that can only read media blobs, and keep account secrets in an env variable.
The script has been modified a little to only need the blob CSID and a size format type rather than the entire API endpoint path.
https://gist.github.com/jessemartinez/167465e25cfe72e811e09915c1dacd85
Thanks,
Jesse
On Thu, Mar 4, 2021 at 11:39 AM William Wolf <ww@williwolf.netmailto:ww@williwolf.net> wrote:
Hi,
I have reviewed the Talk archive about how to get a media image into a Jasper report. Is there any newer documentation about this?
I saw these two:
I have been trying to use the second method and would like to share my unsuccessful result and ask for suggestions. Thanks, Willi
(I’ve obscured the server and tenant values. )
http://server:8180/cspace/tenant/view/blobs/537ef32f-25c3-4abd-b0f0/content
Or this:
Resulting in this:
<html> <head> <meta charset="UTF-8" /> </head> <body> <div id="cspace"></div> <script src="/cspace-ui/cspaceUI@5.1.3.min.js<mailto:/cspace-ui/cspaceUI@5.1.3.min.js>"></script> <script src="/cspace-ui/cspaceUIPluginProfileFCart@3.0.1.min.js<mailto:/cspace-ui/cspaceUIPluginProfileFCart@3.0.1.min.js>"></script> <script> cspaceUI({ basename: '/cspace/tenant', plugins: [ cspaceUIPluginProfileFCart(), ], prettyUrls: true, tenantId: '10', }); </script> </body> </html>Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Thanks Ray and Jesse.
It seems there is something wrong with my cspace-services. I need to dig into the logs this weekend.
I can only get 200 OK response and html and not the actual images. I'm not an expert in this area, let me know if something obvious jumps out, but I hope to find the issue in the logs. --Willi
<html> <head> <meta charset="UTF-8" /> </head> <body> <div id="cspace"></div> <script src="/cspace-ui/cspaceUI@5.1.3.min.js"></script> <script src="/cspace-ui/cspaceUIPluginProfileFCart@3.0.1.min.js"></script> <script> cspaceUI({ basename: '/cspace/my_tenant_name', plugins: [ cspaceUIPluginProfileFCart(), ], prettyUrls: true, tenantId: '10', }); </script> </body> </html>-----Original Message-----
From: Ray Lee ray.lee@lyrasis.org
Sent: Thursday, March 4, 2021 10:21 AM
To: Jesse Martinez mjesse@gmail.com; William Wolf ww@williwolf.net
Cc: talk@lists.collectionspace.org
Subject: Re: [Talk] Jasper report with media image
Hi Willi,
A URL to retrieve an image directly from the REST API for a given media csid would look like these:
https://core.dev.collectionspace.org/cspace-services/media/aead8795-e943-415a-910a/blob/derivatives/Thumbnail/content
https://core.dev.collectionspace.org/cspace-services/media/aead8795-e943-415a-910a/blob/derivatives/Small/content
https://core.dev.collectionspace.org/cspace-services/media/aead8795-e943-415a-910a/blob/derivatives/Medium/content
https://core.dev.collectionspace.org/cspace-services/media/aead8795-e943-415a-910a/blob/derivatives/OriginalJpeg/content
https://core.dev.collectionspace.org/cspace-services/media/aead8795-e943-415a-910a/blob/content
Or, for a given blob csid (stored in the blobCsid field of the media record):
https://core.dev.collectionspace.org/cspace-services/blobs/3163a6bc-7e2b-410f-9d05/derivatives/Thumbnail/content
https://core.dev.collectionspace.org/cspace-services/blobs/3163a6bc-7e2b-410f-9d05/derivatives/Small/content
https://core.dev.collectionspace.org/cspace-services/blobs/3163a6bc-7e2b-410f-9d05/derivatives/Medium/content
https://core.dev.collectionspace.org/cspace-services/blobs/3163a6bc-7e2b-410f-9d05/derivatives/OriginalJpeg/content
https://core.dev.collectionspace.org/cspace-services/blobs/3163a6bc-7e2b-410f-9d05/content
All of those requests require basic auth. Jesse's script is a good place to start. There are also ways to publish blobs so that they are publicly accessible to anyone without credentials, if that's appropriate for your images.
Ray
Ray Lee
CollectionSpace Senior Developer
LYRASIS
ray.lee@lyrasis.org
From: Talk talk-bounces@lists.collectionspace.org on behalf of Jesse Martinez mjesse@gmail.com
Sent: Thursday, March 4, 2021 12:21 PM
To: William Wolf
Cc: talk@lists.collectionspace.org
Subject: Re: [Talk] Jasper report with media image
Hi Willi,
I created that fetchimage.php script for the Oakland Museum some years back. I can share the code I used for this, which is/was running on CSpace v4.2 (I think). I recommend running this only from localhost and/or tightening up the code as you see fit. Maybe create a dedicated CSpace user account that can only read media blobs, and keep account secrets in an env variable.
The script has been modified a little to only need the blob CSID and a size format type rather than the entire API endpoint path.
https://gist.github.com/jessemartinez/167465e25cfe72e811e09915c1dacd85
Thanks,
Jesse
On Thu, Mar 4, 2021 at 11:39 AM William Wolf <ww@williwolf.netmailto:ww@williwolf.net> wrote:
Hi,
I have reviewed the Talk archive about how to get a media image into a Jasper report. Is there any newer documentation about this?
I saw these two:
I have been trying to use the second method and would like to share my unsuccessful result and ask for suggestions. Thanks, Willi
(I've obscured the server and tenant values. ) http://server:8180/cspace/tenant/view/blobs/537ef32f-25c3-4abd-b0f0/content
Or this:
Resulting in this:
<html> <head> <meta charset="UTF-8" /> </head> <body> <div id="cspace"></div> <script src="/cspace-ui/cspaceUI@5.1.3.min.js<mailto:/cspace-ui/cspaceUI@5.1.3.min.js>"></script> <script src="/cspace-ui/cspaceUIPluginProfileFCart@3.0.1.min.js<mailto:/cspace-ui/cspaceUIPluginProfileFCart@3.0.1.min.js>"></script> <script> cspaceUI({ basename: '/cspace/tenant', plugins: [ cspaceUIPluginProfileFCart(), ], prettyUrls: true, tenantId: '10', }); </script> </body> </html>Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org