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?

607
7
11-24-2020 11:49 AM
Labels (1)
JamalNUMAN
Esteemed Contributor

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?

 

Clip_405.jpgClip_406.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos
7 Replies
DanPatterson
MVP Esteemed Contributor

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())

... sort of retired...
NathanShephard
Esri Contributor

Hi Jamal,

Here are some other links that might be useful (for interacting with attachments without code):

Hope this helps!

Thanks,

-Nathan.

JamalNUMAN
Esteemed Contributor

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())

 

Clip_644.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos
AlyciaRajendran_esri
Esri Contributor

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

JamalNUMAN
Esteemed Contributor

Thank you Alycia for the help.

The error persists to exist as per the screenshot below

 

Clip_652.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos
AlyciaRajendran_esri
Esri Contributor

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

JamalNUMAN
Esteemed Contributor

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?

Clip_674.jpgClip_675.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos