Populate database from external app

edited October 20 in General support

Hello,

I am developing a custom app for sports event photography. The photos are downloaded to the computer and copied to several drives as they are taken. Zenphoto gives us a good solution for showing the pics to potential customers but there is a small problem.

Since many photos are being taken (around 80-100 every 3 minutes) it takes quite long to update the database using the standard method (just reloading the page), so it will be quite 'boring' for customers to wait until the database has been updated.

My idea is to populate the database with the new pictures as they are taken. I will, first, create the entry on the database and then, copy the new pic at a proper resolution. But my doubt is how Zenphoto checks if new pictures have been added since the last time the page was loaded. I need a way to tell Zenphoto that everything is up to date so it does not need to check all the pictures again.

By the way, both the database and photos will be on a local network, not on Internet.

Kind regards,

Ivan

Comments

  • acrylian Administrator
    edited October 20

    I will, first, create the entry on the database and then, copy the new pic at a proper resolution.

    This will not work, the image must be there first as Zenphoto's gallery is file system based and a db entry without an image being present will remove the db entry.

    If you upload via the backend the database entry is created while doing that respectively after uploading. But if you bypass Zenphoto by for example uploading via FTP the iamges are added on discovery. How that works is described here under "Image cache": https://www.zenphoto.org/news/caching/#--image-cache

    The "cache" refers not to the db adding itself but goes with it. "Caching" means creating the resized and/or cropped image version like thumbs your site's theme requires. That "resizing work" done by the server is what you actually encounter as taking time.

    You could workaround that if you also upload the image sizes required already to the cache folder. But if you don't create these offline the server will have to do the work and use time as well.

    Or you only use the full size images on your theme (you need to modify whatever theme you are using for that). But if these images are hires that will naturally also slow down loading for visitors.

    I hope this help for now.

  • Thanks. Is there a way that I can do it but through an API instead of using the website? I mean, making the proper calls from my app so it is done as I take the pictures instead of when the pages are opened. I have no time to do it manually using the backend. These sports events are really fast paced. It's artistic skating and I have a new skater on the floor every 3-4 minutes with just 30-40 seconds between each one.

    Thanks in advance.

  • acrylian Administrator

    I am sorry, there is no API for this. I think the easiest right now would probably be to send url requests to the front end pages of the related albums to refresh them that way.

  • This could work. Thanks.

Sign In or Register to comment.