Working wirh Images

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:

Working wirh Images

Post by dlee » 2020-06-14 15:49

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

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

Re: Working wirh Images

Post by pbottcher » 2020-06-14 19:32

Hi,

in the detail view you should have the option to remove the image.
remove.PNG
remove.PNG (753 Bytes) Viewed 2787 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.
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: Working wirh Images

Post by dlee » 2020-06-14 23:02

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
Attachments
inspections.jpg
inspections.jpg (41.25 KiB) Viewed 2779 times

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

Re: Working wirh Images

Post by pbottcher » 2020-06-15 17:42

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 2748 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 ...
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: Working wirh Images

Post by dlee » 2020-06-15 20:57

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

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

Re: Working wirh Images

Post by dlee » 2020-06-17 22:39

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;
	}

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

Re: Working wirh Images

Post by pbottcher » 2020-06-20 07:15

Hi,

you need to add

Code: Select all

global $Translation;
before you assign the values.
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: Working wirh Images

Post by dlee » 2020-06-21 17:40

Thanks for helping pbottcher. Can you explain what "global $Translation" does?

TD

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

Re: Working wirh Images

Post by pbottcher » 2020-06-21 19:52

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

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Working wirh Images

Post by jsetzer » 2021-07-09 06:59

Problem with deleting image:
See also viewtopic.php?f=11&t=4080&p=17747#p17747
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

Post Reply