Page 1 of 1

Working wirh Images

Posted: 2020-06-14 15:49
by dlee
I created a table then added a field to record the image name. When i run my app I can upload an image but there is no button to delete an image after it is uploaded. I need a way to delete these images.

My second problem is I need to specify the folder that the image will be uploaded into; I will have 12-18 such folders. How can I do this?

TD

Re: Working wirh Images

Posted: 2020-06-14 19:32
by pbottcher
Hi,

in the detail view you should have the option to remove the image.
remove.PNG
remove.PNG (753 Bytes) Viewed 5025 times
The image path is controlled via the

$Translation['ImageFolder'].

So if you change that you can change the directory to which the image will be saved.

Re: Working wirh Images

Posted: 2020-06-14 23:02
by dlee
There doesn't seem to be a detail view of the records in this table. Attached is a screen capture of the app. Clicking on the record does nothing.
The user has permission to do everything to the detail view.

TD

Re: Working wirh Images

Posted: 2020-06-15 17:42
by pbottcher
Hi,

I guess the issue is that you have enabled zooming for the images and hence there is no link to the detail record any more.
zooming.PNG
zooming.PNG (1.23 KiB) Viewed 4986 times
So, either you disable that option,
or you make the description mandtory (like this you can click on that link to go to the detail view)
or you create a custom action (see https://bigprof.com/appgini/help/advanc ... ch-actions) in order to select the record and go to the details of that record
or ...

Re: Working wirh Images

Posted: 2020-06-15 20:57
by dlee
Thanks pbottcher, disabling zooming fixed the problem. The user can still zoom the image in Detail view. How would one know that selecting zooming causes this issue...anyways thank you for your help, much appreciated.

Now, can you get me started on how to go about changing $Translation['ImageFolder'] when the new image is saved? There will be 12-18 folders for images.

TD

Re: Working wirh Images

Posted: 2020-06-17 22:39
by dlee
I tried this but it doesn't work, can someone point me in the right direction please?
TD

Code: Select all

function inspections_before_insert(&$data, $memberInfo, &$args) {
		
		$Translation['ImageFolder'] = './images/duck-season-2020/';
		
		return TRUE;
	}

	function inspections_after_insert($data, $memberInfo, &$args) {
		
		$Translation['ImageFolder'] = './images/';

		return TRUE;
	}

Re: Working wirh Images

Posted: 2020-06-20 07:15
by pbottcher
Hi,

you need to add

Code: Select all

global $Translation;
before you assign the values.

Re: Working wirh Images

Posted: 2020-06-21 17:40
by dlee
Thanks for helping pbottcher. Can you explain what "global $Translation" does?

TD

Re: Working wirh Images

Posted: 2020-06-21 19:52
by pbottcher
Hi,

it makes read the $Translation array as a global variable rather than a local one. Otherwise $Translation would be a local one and no changes would happen.

Re: Working wirh Images

Posted: 2021-07-09 06:59
by jsetzer
Problem with deleting image:
See also viewtopic.php?f=11&t=4080&p=17747#p17747