Jump to content

Getting an image from a Web Viewer to External Container Storage


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 post
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 post
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 post
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 post
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 post
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 post
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 post
Share on other sites

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
  • Similar Content

    • By ggt667
      Is there a way to query CWP using FMPXMLRESULT as payload to create new records in FileMaker? Goal is to be able to insert records from command line using curl from FMPXMLRESULT files to avoid a somewhat clunky query from FileMaker XML import.
      I tried the following:
      cd /tmp/ curl -X POST -kL -o /tmp/findany.fmpxmresult.xml "user:pass@127.0.0.1/fmi/xml/FMPXMLRESULT.xml?-db=PushTest&-lay=Table&-findany" curl -X POST -kL --data @findany.fmpxmlresult.xml "user:pass@127.0.0.1/fmi/xml/FMPXMLRESULT.xml?-db=PushTest&-lay=Table&-new" A new record is created, however the payload is ignored.
      Payload below FTR
      <?xml version="1.0" encoding="utf-8" standalone="no"?><!DOCTYPE FMPXMLRESULT PUBLIC "-//FMI//DTD FMPXMLRESULT//EN" "http://127.0.0.1/fmi/xml/FMPXMLRESULT.dtd"> <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"> <ERRORCODE>0</ERRORCODE> <PRODUCT BUILD="03/16/20" NAME="FileMaker Web Publishing Engine" VERSION="18.0.4.428"></PRODUCT> <DATABASE DATEFORMAT="MM/dd/yyyy" LAYOUT="Table" NAME="PushTest" RECORDS="17" TIMEFORMAT="HH:mm:ss"></DATABASE> <METADATA> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="name" TYPE="TEXT"></FIELD> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="number" TYPE="NUMBER"></FIELD> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="date" TYPE="DATE"></FIELD> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="timestamp" TYPE="TIMESTAMP"></FIELD> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="time" TYPE="TIME"></FIELD> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="_global" TYPE="TEXT"></FIELD> </METADATA> <RESULTSET FOUND="1"> <ROW MODID="13" RECORDID="24"> <COL> <DATA>Sweet</DATA> </COL> <COL> <DATA>667</DATA> </COL> <COL> <DATA>06/05/2020</DATA> </COL> <COL> <DATA></DATA> </COL> <COL> <DATA>10:44:15</DATA> </COL> <COL> <DATA></DATA> </COL> </ROW> </RESULTSET> </FMPXMLRESULT> If I simply put the parameters after the "?" in the payload file it works, however INSERTing the actual FMPXMLRESULT would be desirable.
      curl -X POST -kL --data @/tmp/GETlike.txt "user:pass@127.0.0.1/fmi/xml/FMPXMLRESULT.xml" Where /tmp/Getlike.txt contains
      -dbnames as pr example returns expected list of database names.
    • By Msaeed
      Hi All,
      I would like to find solve my issue, as mentioned on the topic of how can find more than fields like serial No. or Code by IOS camera. please find below the script.
       
       
       
      thank in advance for any help or support  
    • By tomp
      I'm having a problem getting BE_SMTPsend to successfully send an email with an attachment.
      No problem sending without an attachment, but when I add an attachment, I get an error 2 (not sure exactly what that means, but without the attachment, no error)
      These are the argument strings with and without attachments:

      I have tried both relative and direct file paths for the variable $attachment. Examples are:


      Both of them return an error code of 2.
      Since the 'send' without an attachment works, all the values of the fields/variables other than $attachment must be valid.
      Can anyone offer a suggestion as to what might be going on and what I might try to resolve this?
       
    • By Msaeed
      Hi All,
      As per mentioned on topic, in fact i would like to create icon ex. hour in case rigging guard the insert time.

    • By Solvax
      Hi,
      I'm trying to make a subsummary report with data from the current table and a related table.
      I never get to display the correct totals for the related table, and would therefore appreciate your help.
      First I'll try to explain the workflow:
      I have two tables called 'Voorraad_uit' (= outgoing stock) and 'Voorraad_in' (= incoming stock) which are related by delivery number.
      Data is first entered in 'Voorraad_in' (= incoming stock) and then related records are created in 'Voorraad_uit' when an incoming stock item is partly or completely shipped.  This second table contains mainly the outgoing amount and a unique outgoing delivery ID.

      As a consequence, one record in table 'Voorraad_in' (= incoming stock) can have one ore more related records in 'Voorraad_uit' (=outgoing stock).
      I want to make a subsummary report showing the total amount of incoming and outgoing units per product(name) by using the following layout structure:

      I tried two scenarios which each give me a part of the desired result.
      when I base the layout on 'Voorraad_in' (=incoming stock): I get the right totals for incoming deliveries I get all the incoming deliveries listed (also those without outgoing delivery) Body part 3 (see above) only shows one row also when there are more than one related outgoing transactions I get the wrong totals for outgoing deliveries (only based on one record) when I base the layout on 'Voorraad_uit' (=outgoing stock): I get the wrong totals for incoming deliveries I don't get all the incoming deliveries listed (only those with outgoing delivery) Body part 3 (see above) shows all the related outgoing transactions I get the right totals for outgoing deliveries Main goal is having the right totals for both incoming and outgoing deliveries..
      My layout is sorted ascending by (in mentioned order) productname, incoming delivery number and outgoing delivery number.
      The totals are calculated by using summary fields.
      I hope I'm on the right track and that the desired result is possible.. your help is much appreciated!
      Thanks in advance for your help.
      Regards,
      Solvax
×
×
  • Create New...

Important Information

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