Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question/Bug] Field type Photo don't store in the attribute field the custom directory #374

Closed
jonnyforestGIS opened this issue May 4, 2017 · 7 comments
Assignees
Milestone

Comments

@jonnyforestGIS
Copy link

I create a folder inside of _images:

When i define a field as type Photo in Roam, i check the save to file option and try to use absolute paths and relative paths:
Attempt 1 Relative path: _images\fecho
Attempt 2 Absolute path: C:\IntraMaps Roam\projects\ProjectGIS_images\fecho

In both cases,
Roam save in _images folder outside of the custom folder that i create. Another thing, when i open the attribute table of spatiallite in QGIS we only store the name of the file in the field of the photo.

How can i add the directory with the name of the file in the field?

Regards,
João

@bwragg
Copy link

bwragg commented May 25, 2017

I was having the same problem. Seems to be caused in featureform.py around line 862. Passes in a folder which seems to be the projects default location (_image). This seems to overwrite the location you set for that field.

folder = self.form.project.image_folder saved = wrapper.save(folder, filename)

@jonnyforestGIS
Copy link
Author

Hi @bwragg can you suggest any workaround for this situation?

@bwragg
Copy link

bwragg commented Jun 1, 2017

Sorry for the delay into getting back to you. In my project every time I save every image field I have a custom location to save it. The following hack only works if this is the case.

I'm new to all this and not setup properly on github or with compilers on my desktop so as a quick work around I just copied the imagewidget.py from the source into the libs/roam/editorwidgets directory, renamed the existing imagewidget.pyc to something like imagewidget.pyc.old.

Then I edited the imagewidget.py and at line 364 in the save function I changed this:
saved, name = save_image(self.widget.getImage(), folder, filename)

to this
saved, name = save_image(self.widget.getImage(), self.defaultlocation, filename)

notice I changed folder to self.defaultlocation. So this forces it to use the value from the default location you can specify in the config manager rather than the value that the previous function passes in.

Hope that helps.

@jonnyforestGIS
Copy link
Author

@bwragg i'm sorry for my delay answer i will check your workaround. Thanks for your tip.
Cheers,
João Gaspar

@bwragg
Copy link

bwragg commented Aug 14, 2017

just further on this I found this creates a problem after capturing the initial feature. When I select a feature the info section on the right shows a broken link and when I edit the feature the images are missing. There is a way to fix it on the edit feature page by changing the following in featureform.py around line 508:

value = os.path.join(self.form.project.image_folder, value)

needs to become:

value = os.path.join(wrapper.defaultlocation, value)

but this still doesn't fix it on the info section.

@bzeeb bzeeb added the bug :( label Nov 10, 2017
@bzeeb bzeeb added this to the 2.6 milestone Nov 10, 2017
NathanW2 added a commit that referenced this issue Nov 10, 2017
@NathanW2
Copy link
Contributor

@jonnyforestGIS sorry this is a case of bad UI. The location you set in the config isn't for the save location it's for the default open location. I have changed the UI to make that clearer.

@jonnyforestGIS
Copy link
Author

Ok thanks. I will close this. Sorry for my late answer...
Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants