How to load images via PHP code

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

How to load images via PHP code

Post by KSan » 2014-04-02 19:00

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.

User avatar
a.gneady
Site Admin
Posts: 1287
Joined: 2012-09-27 14:46
Contact:

Re: How to load images via PHP code

Post by a.gneady » 2014-04-02 23:51

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.
:idea: 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.

KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

Re: How to load images via PHP code

Post by KSan » 2014-04-03 01:12

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.

KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

Re: How to load images via PHP code

Post by KSan » 2014-04-03 03:57

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.

User avatar
a.gneady
Site Admin
Posts: 1287
Joined: 2012-09-27 14:46
Contact:

Re: How to load images via PHP code

Post by a.gneady » 2014-04-05 08:20

:idea: 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.

KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

Re: How to load images via PHP code

Post by KSan » 2014-04-05 17:56

Ah, no wonder I couldn't find it in your code! :lol: Please see my email on this topic. Ready to throw the towel on this one. Thanks for your help.

Post Reply