Jump to content
Server Maintenance This Week. ×

Database stored in Dropbox recreates image paths when accessed from different computers


This topic is 4618 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I keep my database in Dropbox (online storage) so that I and others can access it from their computer. The images that are linked to the database are also kept in the Dropbox folder. However, when I access the database from a different computer, it is not able to display the image due to the path. When I look at the path to the image, it seems to change and incorporate the hardrive of the computer that is accessing the database, therefore breaking the links. There are over 3000 images so I want to keep the images as links and not imbed them. Any suggestions?

Link to comment
Share on other sites

Ok, so clearly DropBox is not the way to go, thanks for the warning. Fortunately I have a backup of the database that has all the proper links to the images, and I have a text field that shows the filepath to these images. However, I work on the database when at home on my desktop computer, and when I travel (which is frequently), I simply drag the folder that contains the database and all the image folders and subfolders to my laptop so that I can work on it on my laptop while I am away. I am not able to have a dedicated computer that is on all the time for proper hosting. So what is the best way to move the database back and forth between computers while preserving the links to the images?

Perhaps using a calculated field for the container field that displays the image with a path relative to the location of the database file, as suggested by dansmith65? Although I'm not exactly sure how to create the calculation.

Lets say my images are stored as HardriveA/Database/Images/SubfolderA/image1.jpg. The blue indicates the initial portion of the filepath, which is constant for all images, the section in red indicates the portion of the filepath that is specific to each image. So the new path calculation would need to combine a new blue portion (e.g. HardriveB/Database/Images/), which I could store in a global field, and that can be modified anytime I change computers, and have the calculation add the red portion, which would have to be retrieved as the last portion of the current image path (SubfolderB/image2.jpg or SubfolderC/image3.jpg or SubfolderD/image4.jpg, etc.) to display the image stored in HardriveB/Database/Images/SubfolderB/image2.jpg.

How do I create this calculation?

Link to comment
Share on other sites

In your first post you said "I and others" can access it, but what you are proposing is to have a very personal and individual copy of the DB and images that will hop between your home desktop and traveling laptop. Your attempt to use Dropbox was to overcome the issue of multiple users - where have they now gone in this equation?

To answer your question: Look at the Get(DesktopPath) function to provide you with a constant relative path no matter which computer you are using, although you may also have to accommodate for differences between Mac and PC.

What you are trying to achieve is not trivial (it's not difficult) because you want the data in more than one place at the same time, and very few here would recommend that.

My best advice is to embed the images in your file and look at a professional hosting service.

Link to comment
Share on other sites

Others would use the database simply to match new photos against the catalog. They wouldn't be adding records or doing in depth analysis. My main concern was making my database portable for me since I am the only database manager. Since I'm often on a ship or in remote areas, where internet access is unavailable, I need to have the database available on my laptop.

The Get(DesktopPath) seems to solve the initial hardrive path but I still don't know how to combine that portion of the path with the subfolders and image file paths. Since I have more than 3000 images in the database, embedding the images is not an option.

I don't actually want the database in two places at the same time, I just want to be able to transfer it between computers without disrupting the filepaths. I use Chronosync to sync the two computers so that older files are updated with newer ones. I'm guessing Chronosync can pose problems with the database as well?

Link to comment
Share on other sites

If your images have been inserted as PICTURES then:

"imagemac:" & Get(DesktopPath) & "ImagesFolder/" & "ImageFileName"

(there are restrictions on file types here)

If your images have been inserted as FILES then:

"filemac:" & Get(DesktopPath) & "ImagesFolder" & "/" & "ImageFileName"

where "ImageFileName" needs to be stored on each record

and "ImagesFolder" can be stored or hard coded to a specific folder on the desktop.

Link to comment
Share on other sites

Thanks for that. Is there a way to extract the last 3 components of an old filepath (in this case it would be /subfolder1/subfolder2/filename.jpg)? This would be the portion that is unique to each record. I have the old filepath as a text field for each record. The DesktopPath and other subfolders representing the initial part of the filepath is pretty straight forward as you described. The reason I don't have all the images in one folder is because for each survey I create several folders, one with the date of the survey, another with original image files, another individuals folder, and a folder for each individual. I have it this way so I can keep things organized and go back to original data or an individuals subfolder should I need to. Hope this makes sense.

Link to comment
Share on other sites

Is there a way to extract the last 3 components of an old filepath (in this case it would be /subfolder1/subfolder2/filename.jpg)? This would be the portion that is unique to each record.

Yes, there is. But didn't you say earlier there is a common parent folder to all images, say:

HardriveA/Database/Images/subfolder1/subfolder2/filename.jpg

If so, you can extract the subpath as =

Let ( [

dir = "HardriveA/Database/Images/"

] ;

Right ( Filepath ; Length ( Filepath ) - Length ( dir ) )

)

Link to comment
Share on other sites

Define your container to be a calculation and use the filepath as the calculation. Don't forget to set the calculation result to be "Container".

Please note this will not display generic "filemac:" types, so your files must conform to the permitted file types for "imagemac:" types. (gif, jpg, pdf etc.)

Link to comment
Share on other sites

The full list of available file types is in the help system, see "working with data in container fields"

My point was to expressly state that the images will only show as images under the "imagemac:" protocol and also providing they conform to the file types supported.

Using the "filemac:" protocol will not display the image, even if it is a supported file type for "imagemac:" protocol.

Link to comment
Share on other sites

Ok, I think I jumped the gun thinking I figured this out. The solution below works fine if the GetAsText (Image) gave only the filepath (image:xxx), but it seems for about 600 images, its giving me size:xxx, image:xxx, and imagemac:xxx, all as the filepath, so I can't just subtract a constant string from the beginning of the filepath because it is not constant. Do you know why I'm getting two different formats for the filepath?

Let ( [

dir = "HardriveA/Database/Images/"

] ;

Right ( Filepath ; Length ( Filepath ) - Length ( dir ) )

)

Link to comment
Share on other sites

I thought you already had a text field with the path. To extract the absolute path from the container field, try:

GetValue ( Container ; ValueCount ( Container ) )

Do you know why I'm getting two different formats for the filepath?

It depends on how the field was populated.

Link to comment
Share on other sites

Do you know why I'm getting two different formats for the filepath?

If you are using GetAsText( container ), it will return one format if the container field stores a reference to a file, and a different format if the container field stores the file itself.

Link to comment
Share on other sites

For completeness

GetAsText (StoredImage) returns:

ImageName (there is no path information!)

GetAsText (ReferencedImage) returns:

size:ImageBytes

image:ImageName:

imagemac:ImageFilePath

If you are seeing a mix of the above then you have already got some images stored and others referenced.

I have never seen "image:xxx" returned as the result on its own.

Link to comment
Share on other sites

The solution below works fine if the GetAsText (Image) gave only the filepath (image:xxx), but it seems for about 600 images, its giving me size:xxx

GetAsNumber() returns the image size.

Link to comment
Share on other sites

I thought you already had a text field with the path. To extract the absolute path from the container field, try:

GetValue ( Container ; ValueCount ( Container ) )

It depends on how the field was populated.

Ok, this works.

It looks like I populated the container field differently over the past 7 years so I will have to extract the path differently for the different types of populated container fields (using different field calculations), then create a new field with the new, recreated paths, and reference this field to display the images.

"comment" - would you mind explaining the 4 ways you populated your container field in your Example.zip?

Link to comment
Share on other sites

This topic is 4618 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

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