Highlighted

GOOGLE API / CFDIRECTORY

Participant ,
Apr 23, 2020

Copy link to clipboard

Copied

I have a site now where we use cfdirectory tag to query to get the directory contents.

In the directories are images; like this

  1. image1.jpg
  2. image2.jpg
  3. image3.jpg

Then we use this info to display these images on the page. Anywhere from one to 10 images in each directory.

Now we are moving our images to Google Cloud and cannot use the cfdirectory the way we currently do.

Has anyone used the Google API to query/list directories on the Google cloud and pushed the results back to a cf site?

Once I can get that info from google I can figure how to output images.

Anybody?


Adobe Community Professional
Correct answer by BKBK | Adobe Community Professional

I haven't worked with images the way you're trying to. But I can share with you my experience with APIs in general.

In ColdFusion, a collection of files is represented by a directory. On the API it is represented by a collection resource. Let's call the resource containing the images ImageCollection.

 

Your starting point is then a GET request to the URI of ImageCollection. This is the equivalent of a list-action on cfdirectory.

 

The list will contain the (API resource) ID of each image file. As Dave_Watts has said, you will then have to find a way to identify which ID corresponds to which image file.

 

Take a file whose ID is img1234, for example. To obtain it, you have to perform a GET request to its URI  http://.../ImageCollection/img1234     

 

Views

1.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

GOOGLE API / CFDIRECTORY

Participant ,
Apr 23, 2020

Copy link to clipboard

Copied

I have a site now where we use cfdirectory tag to query to get the directory contents.

In the directories are images; like this

  1. image1.jpg
  2. image2.jpg
  3. image3.jpg

Then we use this info to display these images on the page. Anywhere from one to 10 images in each directory.

Now we are moving our images to Google Cloud and cannot use the cfdirectory the way we currently do.

Has anyone used the Google API to query/list directories on the Google cloud and pushed the results back to a cf site?

Once I can get that info from google I can figure how to output images.

Anybody?


Adobe Community Professional
Correct answer by BKBK | Adobe Community Professional

I haven't worked with images the way you're trying to. But I can share with you my experience with APIs in general.

In ColdFusion, a collection of files is represented by a directory. On the API it is represented by a collection resource. Let's call the resource containing the images ImageCollection.

 

Your starting point is then a GET request to the URI of ImageCollection. This is the equivalent of a list-action on cfdirectory.

 

The list will contain the (API resource) ID of each image file. As Dave_Watts has said, you will then have to find a way to identify which ID corresponds to which image file.

 

Take a file whose ID is img1234, for example. To obtain it, you have to perform a GET request to its URI  http://.../ImageCollection/img1234     

 

Views

1.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 23, 2020 0
Adobe Community Professional ,
Apr 24, 2020

Copy link to clipboard

Copied

The only way I can see you using CFDIRECTORY to iterate through files right now, is to have a local cache of those files that synchronizes with Google Cloud storage. Otherwise, you're going to have to bring back file identifiers and sort them some other way. There are a bunch of command-line tools that will let you connect to Google Cloud to do this, so you could conceivably use one of those.

 

Dave Watts, Eidolon LLC

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 24, 2020 0
Adobe Community Professional ,
Apr 27, 2020

Copy link to clipboard

Copied

I haven't worked with images the way you're trying to. But I can share with you my experience with APIs in general.

In ColdFusion, a collection of files is represented by a directory. On the API it is represented by a collection resource. Let's call the resource containing the images ImageCollection.

 

Your starting point is then a GET request to the URI of ImageCollection. This is the equivalent of a list-action on cfdirectory.

 

The list will contain the (API resource) ID of each image file. As Dave_Watts has said, you will then have to find a way to identify which ID corresponds to which image file.

 

Take a file whose ID is img1234, for example. To obtain it, you have to perform a GET request to its URI  http://.../ImageCollection/img1234     

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 27, 2020 1
Participant ,
Apr 30, 2020

Copy link to clipboard

Copied

So in some cases I have to the Google Cloud Storage is going to return more than one result.

For these I can get the info in XML or JSON format and Ill need to extract certain fields.

Does CF work with one better than the other?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 30, 2020 0
BKBK LATEST
Adobe Community Professional ,
May 03, 2020

Copy link to clipboard

Copied

In my opinion, XML and JSON are just as good as each other in this particular situation. XML has the advantage of being more formal (using namespaces, for example) and it has a tradition in ColdFusion (including search capabilities). JSON's advantage is that it is less cumbersome to work with (being easily converted to a struct) and has a smaller memory footprint in the long run.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 03, 2020 0