Jump to content

Getting an image from a Web Viewer to External Container Storage


This topic is 1379 days old. Please don't post here. Open a new topic instead.

Recommended Posts

This is kind of a unique situation.

When working with Open Library: You can call for Cover images by creating a URL with the ISBN.. and if the Cover is available, it will show up.

e.g.:

"http://covers.openlibrary.org/b/isbn/" & ISBN::ISBN_Search  & "-L.jpg" will give you the image in a web viewer.  Literally, the image only, which is actually a different URL that is not really able to be created via calculation. Otherwise a simple Insert From URL would work.

If I drag that image to a container.. I predictably get the actual URL of the image.

I want to get that image from the Web Viewer into a Container field with -external- storage.  So I can't paste it, or set field..  :)

 

45178366_ScreenShot2020-05-24at23_25_47.thumb.png.c891956aac3c0132e655282595153bd3.png

512976385_ScreenShot2020-05-24at23_22_42.thumb.png.7d8cc25177493e9a87d94db60bf7526f.png

Link to comment
Share on other sites

2 hours ago, Tony Diaz said:

I want to get that image from the Web Viewer into a Container field with -external- storage.  So I can't paste it, or set field..  :)

Why not? 

BTW, I believe you could script the process of getting the image - or rather the URL of the image, by setting your web viewer to the initial URL and pausing for a while before getting GetLayoutObjectAttribute ( "webviewer" ; "source" ). But I don't see how the storage method affects the methods you can use to populate the field.

 

Link to comment
Share on other sites

2 hours ago, MonkeybreadSoftware said:

Do you use MBS FileMaker Plugin?

I should have known. Swiss Army Knife for FileMaker.

Yes, as soon as I can get some extra cash .. this COVID mess has things all the heck over the place. I've been trying to -not- get too reliant on MBS ... yet. 😉

 

4 minutes ago, comment said:

But I don't see how the storage method affects the methods you can use to populate the field.

That's kind of just it. I've not been successful with extracting that filename from the webviewer instance.

Given that there's nothing else there.. and even if I capture that URL, I'm not sure it would work because hard coding

http://ia800603.us.archive.org/view_archive.php?archive=/15/items/olcovers554/olcovers554-L.zip&file=5546156-L.jpg&ext=

and use that with Insert URL it doesn't work at all. But .. I just tried it without the trailing text past the type .ext and I'm back to getting the unable to "Can not write file to the external storage ... which is where I'm ending up no matter what route I take.

I can get it into an internally stored container, but not an external one. Which I kinda of get, as the external container is based around having a filename / INODE to handle.. and the internal container is a blob of data.

So, save it some place with a predictable filename, then insert from file to the container.

Set Field [ ISBN::ISBN_Cover ; ISBN::ISBN_Cover Holding ] 
Set Variable [ $TempFILE ; Value: "File.jpg" ] 
Export Field Contents [ ISBN::ISBN_Image_L ; “$TempFILE” ; Create folders: Off ] 
Insert File [ “$TempFILE” ] 

Something hack like this .. and I -still- get cannot write to external storage.

MBS... Hmmmm...

Using MBS, I get the impression that with either of those functions I'm going to get a 1:1 pixel image of what is in the web viewer. Including the white space. I want the actual asset.

Link to comment
Share on other sites

Yes, that does. Now to see what you've got going on there.. :)

The desired end result is to take the largest of what is offered and stick it in my container field, or mine if I need to shoot one with the USB camera ... (MBS Plug In) or Insert From Device for the iPad.

Thanks for the boost in the right direction. :)

Link to comment
Share on other sites

--

.. That's interesting, though. At the end of it all:

Set Variable [ $redirectURL ; Value: GetLayoutObjectAttribute ( "OpenLiibraryLargeImg" ; "source" ) ] 
Insert from URL [ Select ; With dialog: On ; Target: ISBN::ISBN_Cover ; $redirectURL ] 

...and along the lines it seems like I did that exact thing, though I was getting the URL with ''&ext=' appended to it.

// Set Variable [ $ISBN_Image_L1 ; Value: Left ( $ISBN_Image_L ; -4 ) ]  

.... my sorry attempt at brute force figuring out the syntax to drop the extra characters.

Now back to trying to figure out how to get the book title out of that JSON data. Since they don't seem to have a unique identifier for it. (There's several uses of "title: \"" in there)

Thanks! :)

Link to comment
Share on other sites

I saw that. :) I'm not hitting them up for very many at all.  I'm not doing anything more than I would by using their search box as a passive user. If this were a solution being done for distribution or deployment in a working environment..

Otherwise, what I'm looking for on there I'd hardly even begin to call anywhere near a smidgen of 'bulk'. I'll probably end up providing more than not overall. 

Link to comment
Share on other sites

  • 1 month later...
On 5/25/2020 at 3:54 AM, comment said:

Does the attached test work for you?

InsertFromRedirectURL.fmp12 164 kB · 9 downloads

On this, you're getting the image into a web viewer first, then inserting from that URL, to the container.

It works, as little as 1 second delay is fine, too- hasn't failed in any testing. Though yes, I realize it may need more .. so for testing the 5 second pause is what I fall back onto just to make sure.

With some slight changes, it's still good: (I have the direct URL already stored in a field).

1403020756_ScreenShot2020-07-10at08_18_46.thumb.png.bb20c33b92697de5f825cc3f296c547c.png

 

So taking that same thing and using it here to get the screenshot and thumbnail image. (Yes, I could probably just have FileMaker create that thumbnail too I suppose)

379333372_ScreenShot2020-07-10at08_29_16.thumb.png.62290835da570ad964b6c8048acb00ae.png

 

For some reason, I have to do this twice to get it to work. The first time it runs, I'll get this:

37855426_ScreenShot2020-07-10at08_29_41.thumb.png.00a035a6c634e3cd645de7d07aea36fa.png

 You can see the images are in the web viewer elements, the second container field is selected and thats all I get...
(If I right-click in the web viewer, to move it back to no image showing, then itl won't do it on this next run. )

So if I run it again it will work the second time. As long as those web viewers show the image loaded like it is above.

1059983557_ScreenShot2020-07-10at08_29_58.thumb.png.a5eb6f8d65dd01a6333181c0b676dffc.png

 

 

The end result is, I'd like to have it get those images that the URLs came from in the data below..  why there needs to be the web viewer in the flow doesn't make sense, but whatever, fine. But it's not consistent either.

Seems like I could probably save the file to the local disk via cURL and then insert the file into the container.. but then that's twice the disk access. Shouldn't it just be able to get the image from the URL .. and actually put that into the container, not putting an icon or URL into the container instead?

 

Set Variable [ $screenshots ; Value: JSONGetElement ( Items::JSON_Blob_Detail ; "screenshots" ) ] 
 
If [ not IsEmpty( $screenshots ) ] 
	Set Field [ Items::JSON_VariableView0 ; $screenshots ] 
	Set Variable [ $PLATFORM_ID ; Value: "5" ] 
	Set Variable [ $MOBY_ID ; Value: Items::Moby_ID ] 
	Set Variable [ $n ; Value: ValueCount ( JSONListKeys ( $screenshots ; "" ) ) ] 
	Freeze Window

	Go to Layout [ “Moby_Screenshots_Meta” (Moby_Screenshots_Meta) ; Animation: None ]
	Set Variable [ $existingCaptions ; Value: ExecuteSQL ( "SELECT Caption FROM Moby_Screenshots_Meta" ; "" ; ""  ) ] 
	Loop
		Set Variable [ $i ; Value: $i + 1 ] 
		Exit Loop If [ $i > $n ] 
		Set Variable [ $record ; Value: JSONGetElement ( $screenshots ; $i - 1) ] 
		Set Variable [ $caption ; Value: JSONGetElement ( $record ; "caption") ] 
		If [ IsEmpty ( FilterValues ( $caption ; $existingCaptions ) ) ] 
			New Record/Request
			Set Field [ Moby_Screenshots_Meta::Platform_ID ; $PLATFORM_ID ] 
			Set Field [ Moby_Screenshots_Meta::Moby_IDfk ; $MOBY_ID ] 
			Set Field [ Moby_Screenshots_Meta::Caption ; JSONGetElement ( $record ; "caption" ) ] 
			Set Field [ Moby_Screenshots_Meta::Image_URL ; JSONGetElement ( $record ; "image" ) ] 
			Set Field [ Moby_Screenshots_Meta::Thumbnail_URL ; JSONGetElement ( $record ; "thumbnail_image" ) ] 
			Set Field [ Moby_Screenshots_Meta::Thumbnail_URL ; JSONGetElement ( $record ; "thumbnail_image" ) ] 


			Set Variable [ $redirectURL ; Value: Moby_Screenshots_Meta::Image_URL ] 
			# Stand in code, figure out how to make it work, then put that here.
			Insert from URL [ Select ; With dialog: Off ; Target: Moby_Screenshots_Meta::Screenshots ; $redirectURL ] 
			Set Variable [ $redirectURL ; Value: Moby_Screenshots_Meta::Thumbnail_URL ] 
			Insert from URL [ Select ; With dialog: Off ; Target: Moby_Screenshots_Meta::Thumbnails ; $redirectURL ] 


		End If
	End Loop
	Go to Layout [ original layout ; Animation: None ]
End If

 

Link to comment
Share on other sites

This topic is 1379 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.