ArcGIS Pro 2.6.2: How to display the physical photos saved on the related table that is created as the “enable attachments” option is performed?
For example, in the screenshot below, the related table contains 6 photos. Then how these photos can be displayed or downloaded from the related table? Where are they physically stored?
You have a DATA field which contains Blobs, so given this help topic entry
Accessing data using cursors—ArcGIS Pro | Documentation
You can use arcpy, as per the code examples.
import arcpy
sc = arcpy.da.SearchCursor("c:/data/fgdb.gdb/fc", ["imageblob"])
memview = sc.next()[0]
open("c:/images/image1_copy.png", "wb").write(memview.tobytes())
Hi Jamal,
Here are some other links that might be useful (for interacting with attachments without code):
Hope this helps!
Thanks,
-Nathan.
Thank you guys for the help.
The code below appears not to work as per the screenshot below
import arcpy
sc = arcpy.da.SearchCursor("D:\Q.gdb/T1", ["imageblob"])
memview = sc.next()[0]
open("D:\Q_Images/image1_copy.png", "wb").write(memview.tobytes())
Hi Jamal,
It looks like your file paths are inconsistent with Python formatting. Try this (uses forward slashes only):
import arcpy
sc = arcpy.da.SearchCursor("D:/Q.gdb/T1", ["imageblob"])
memview = sc.next()[0]
open("D:/Q_Images/image1_copy.png", "wb").write(memview.tobytes())
Thanks,
Alycia
Thank you Alycia for the help.
The error persists to exist as per the screenshot below
Jamal,
The error indicates that there is no "imageblob" field in your T1 feature class. If that field name does exist, I suggest contacting technical support; they can assist you better.
Thanks!
- Alycia
The name of the blob field is “data” but not “imageblob” as per the screenshot below.
The code manages to extract one of the photos! Why does it fail to extract all of them?