I have asset records that will have a photo of the system dataplate as a photo attachment.
These will typically be captured in the field by the end user. Until that point the photo field is null.
I would like to preload a “No Image Available” photo into this field that I have stored in my Assets/Images folder in Oxide.
How would I accomplish this? I am assuming there is a URL associated with the photo.
How would I extract this into data that could be loaded into a null photo field?
Thanks,
David
After thinking about this a bit I came to the realization that there is probably no way for the apps to
communicate with the Oxide repository.
I then derived this solution to my issue: Creating a table to hold “Default Photos”
if (view.selected_asset.data_plate) {
return;
}
else {
photoLoadDefault()
}
function photoLoadDefault() {
var nophoto
nophoto = DB.default_photos.first('name =?', "no_photo");
view.selected_asset.data_plate = nophoto.photo;
}
If anyone has an easier suggestion please let me know!
Thanks,
David
1 Like
@jdavidpugh Your solution is fairly eloquent. The only way to access static images uploaded to the Assets workspace in OXIDE is through the component, so if you want / need to use the same <capture-photo />
or <display-photo />
component for both the “No Image Available” default and the eventual asset photo then your proposed solution seems best.
1 Like
I did clean it up a bit the second time…just bundled it all into the helper function.
function photoCheck() {
if (view.selected_asset.data_plate) {
return;
}
else {
var noimage;
noimage = DB.default_images.first("name =?", "no_image");
view.selected_asset.data_plate = noimage.photo;
}
}