Specify image folder for specific page

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
dlee
Veteran Member
Posts: 137
Joined: 2020-04-14 00:21
Location: South Carolina, USA
Contact:

Specify image folder for specific page

Post by dlee » 2021-08-20 17:13

I have an existing dynamic website that I hope to replace the existing backup end with a Appgini app. The existing dynamic website has 23 pages, with each page having it's own image folder. Appgini stores all images in the 'baseUploadPath' specified in the config.php file.

How can I specify a specific image folder for each of the pages/tables in Appgini? Really need for this to happen so [lease help!
Thanks,
TD

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Specify image folder for specific page

Post by pbottcher » 2021-08-23 16:05

Hi,

I did not try this, but I think if you use the hooks/header-extras.php you could overwrite the default path $Translation['ImageFolder'] with one for your table. So check on which table you are currently working on and set $Translation['ImageFolder'] to the appropiate folder.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

dlee
Veteran Member
Posts: 137
Joined: 2020-04-14 00:21
Location: South Carolina, USA
Contact:

Re: Specify image folder for specific page

Post by dlee » 2021-08-23 23:08

Thank you pbottcher for trying to help. Over the last couple of days I have tried many things and learned some things. I am using Appgini Pro Edition, version 5.97, revision 1142 to create my webapp.

In this version of Appgini, the path for the images folder in pulled from the config.php file, specifically the property (?) 'baseUploadPath'. I know this because I manually edited the value of 'baseUploadPath' and it changed where the images were saved to.

I tried the following to determine when the config.php file was read: I opened the config.php file in Notepad++, then opened my webapp and started the process of uploading a new image. At the point where you select the image and click the OPEN button, I changed the config.php to show a different path than the one the webapp opended with and the image was saved to the new location, once I clicked the OPEN button. So it appears the config.php file is read as part of the INSERT event.

I have tried adding this to the /hooks/header-extrs.php file:

Code: Select all

<?php
	$adminConfig['baseUploadPath'] = './images/gallery/duck-season-2015';
?>
Didn't work.

Next I tried adding the same thing to the /hooks/duck-season-2015.php in the INIT section and then in the BEFORE INSERT event section:

Code: Select all

<?php
	$adminConfig['baseUploadPath'] = './images/gallery/duck-season-2015';
?>
Didn't work.

The only thing that half way worked was I created the file adsisc.php:

Code: Select all

<?php
	global $fdr;
	$fdr = './images/gallery/';
?>
Then I added this code at the end of config.php:

Code: Select all

	include_once "adsisc.php";	
	$adminConfig['baseUploadPath'] = $fdr;

This worked but what I really would like is to set the value of $fdr in the BEFORE INSERT event in the /hooks/duck-season-2015.php file. I tried doing this:

Code: Select all

function duck_season_2015_init(&$options, $memberInfo, &$args) {

	include_once 'adsisc.php';		
	return TRUE;
	
}
and

Code: Select all

function duck_season_2015_before_insert(&$data, $memberInfo, &$args) {
	
	$fdr = './images/gallery';	
	return TRUE;
	
}
and finally modifiy adsisc.php:

Code: Select all

<?php
	global $fdr;
?>
Did not work, seems the value of $fdr never makes the trip to config.php via adsisc.php.

So, I am sure I have missed something and I am hoping you guys can help me figure this out'
TD

Post Reply