• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

GOOGLE API / CFDIRECTORY

Participant ,
Apr 23, 2020 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?


Views

1.8K

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
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 27, 2020 Apr 27, 2020

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. A

...

Votes

Translate

Translate
Community Expert ,
Apr 24, 2020 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

Dave Watts, Eidolon LLC

Votes

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
community guidelines
Community Expert ,
Apr 27, 2020 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     

 

Votes

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
community guidelines
Participant ,
Apr 30, 2020 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?

Votes

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
community guidelines
Community Expert ,
May 03, 2020 May 03, 2020

Copy link to clipboard

Copied

LATEST

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.

Votes

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
community guidelines
Resources
Documentation