HI, I would like some help regarding the following, I don't know if the solution is via hooks or using js!
Required: I would like to automatically have a default image load onto my DV template (+tv but not imperative) when a member does not upload a profile picture. The image field is not mandatory its member choice, however rather that having no image or a default small gif when they don't upload an image I'd like to show a standard default image.
It needs to apply to just one group (member) for my senario and the default image would apply to all/any user that decides not to upload/save an image to their record.
I'm sure there must be a simple way to achieve this (I even think I did it before years ago!) but my memory is not what it once was, so I've forgotten how - pls help, thank you.
No Image Uploaded - default image req'd
No Image Uploaded - default image req'd
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course
Re: No Image Uploaded - default image req'd
Hi
you could add an image to the images folder and use sql to add this image in the after insert hook.
you could add an image to the images folder and use sql to add this image in the after insert hook.
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.
Re: No Image Uploaded - default image req'd
Hi,
Not having much luck - lattest effort was
my table = your_horse
my field = horse_pic
my image to be shown if the user does not upload an image when creating or updating their file/record is = no_image.png (in images folder)
Hope you can guide me, thanks
Not having much luck - lattest effort was
Code: Select all
function your_horse_after_update(&$data, $memberInfo, &$args) {
if($data['horse_pic'] == "null") {
$j('#horse_pic-image').attr('src', './images/no_image.png');
return false;
}
return TRUE;
}
my field = horse_pic
my image to be shown if the user does not upload an image when creating or updating their file/record is = no_image.png (in images folder)
Hope you can guide me, thanks
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course
Re: No Image Uploaded - default image req'd
Are you sure this is a string ?$data['horse_pic'] == "null"
Try
null
instead of "null"
If you want to be sure, dump out the current value:
Code: Select all
var_dump($data);
exit;
Last edited by jsetzer on 2023-10-14 15:14, edited 1 time in total.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 25.10 + all AppGini Helper tools
<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 readabilityAppGini 25.10 + all AppGini Helper tools
Re: No Image Uploaded - default image req'd
Hi Ron,
try in the function your_horse_after_insert and function your_horse_after_update
try in the function your_horse_after_insert and function your_horse_after_update
Code: Select all
if (empty($data['horse_pic'])) {
$eo=[];
$sql="UPDATE your_horse set horse_pic='no_image.png' where id={$data['selectedID']}";
sql($sql,$eo);
}
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.
Re: No Image Uploaded - default image req'd
Hi pböttcher,
Placed code as you advised in your_horse_after_insert and function your_horse_after_update.
It worked perfectly - thank you so much, I'd never have found that solution myself.
Cheers,
Ron
Placed code as you advised in your_horse_after_insert and function your_horse_after_update.
It worked perfectly - thank you so much, I'd never have found that solution myself.
Cheers,
Ron
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course