I am developing a mobile app which interacts with my AppGini db. One feature I'd like to implement is the ability to upload photos from my mobile app to my AppGini app. I am able to upload my photos to a folder on the web server and I am able to trigger php scripts on my web server from my mobile app.
What I need to figure out is a way to emulate what happens when you are inside a record detail view and upload a photo. I would like the photo I have saved onto the web server to be "imported" into AppGini which is essentially an act of renaming it as per AppGini random naming rules, resizing it with the _tv & _dv suffixes, saving these files into the proper AppGini folders and then making the appropriate db entries. So in essence I need to write that php script which my mobile app needs to trigger.
Anyone tackled something like this in the past or am I in total darkness? Thanks for any insight you might have.
How to load images via PHP code
Re: How to load images via PHP code
Please check the code of the function PrepareUploadedFile() in "lib.php" and the function createThumbnail() in "admin/incFunctions.php" ... these are the ones used to perform the actions you mentioned.
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
Re: How to load images via PHP code
Thanks for the pointer. I also see how these functions are called in my images_dml.php as :
$data['image'] = PrepareUploadedFile('image', 1022976, 'jpg|jpeg|gif|png', false, "");
if($data['image']) createThumbnail($data['image'], getThumbnailSpecs('images', 'image', 'tv'));
if($data['image']) createThumbnail($data['image'], getThumbnailSpecs('images', 'image', 'dv'));
I have to try piecing all this together now but I think I have a good starting point. Will post back how far I get. Thank you.
$data['image'] = PrepareUploadedFile('image', 1022976, 'jpg|jpeg|gif|png', false, "");
if($data['image']) createThumbnail($data['image'], getThumbnailSpecs('images', 'image', 'tv'));
if($data['image']) createThumbnail($data['image'], getThumbnailSpecs('images', 'image', 'dv'));
I have to try piecing all this together now but I think I have a good starting point. Will post back how far I get. Thank you.
Re: How to load images via PHP code
Ahmad, Can you kindly let me know where I can find the following function?
move_uploaded_file
I see it referenced in PrepareUploadedFile but I can't find it in the sea of code. Thanks so much for your pointer.
move_uploaded_file
I see it referenced in PrepareUploadedFile but I can't find it in the sea of code. Thanks so much for your pointer.
Re: How to load images via PHP code
This is a standard PHP function: http://www.php.net/manual/en/function.m ... d-file.php
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
Re: How to load images via PHP code
Ah, no wonder I couldn't find it in your code! Please see my email on this topic. Ready to throw the towel on this one. Thanks for your help.