Standard image for user profile if they choose not to upload a file

Hi There,

Ik have a form for users to make an account. everything works fine, except for the image
the user is allowed to upload a profile picture that is stored as an name in the database and the image file is stored in an imagefolder on the server.

That also works.

on the oninit i use this code to choose a standard profile picture, if the user doesn’t upload one

{profiel_afbeelding} = (“profiel_brixx.png”);

that also works. But when the user decided to delete this file, al users with no profile picture have no standard picture.

I understand what is happening, so i decided to make this file read only in the folder, that doesn’t have any effect. the user is still allowed to delete the standard picture.

Any idea how i can use some code to stop this, and let users still choose a new picture, but doesn’t allow to delete the standard one?

Thx. on vacation now, i’ll try it out and let you know. Do i put this in the onload section?

The delete option is gone but when i use this script, the name of the file is also changed. any idea?

if ({ev_banner} = “brixx_banner.png”)
{
echo’
<style>
#chk_ajax_img_ev_banner{
display: none;}
</style>’;

}

else
{
}

What do you . mean by changed? It’s no longer visible?

if i use the code as above, the input changes to brixx_banner.png instead of the original name

for example, their is a filename test.png in the field from a previous save. When i use this code that name wil be automatically changed in brixx_banner.png.

i don’t see whats wrong?

The delete button btw is gone. thanks

use double == to compare

if ({ev_banner} == "brixx_banner.png")

:rolleyes: Thanks!

strange after an update of scriptcase the above script does’nt work anymore…

What’s the code and where placed in which event?

it’s placed in the onLoad

this?

if ({ev_banner} = "brixx_banner.png")
{
echo'
<style>
#chk_ajax_img_ev_banner{
display: none;}
</style>';

}
else 
{
}

yes, i don’t know where else to put it

this is caused by a bug in sc9.4.003. When refering to an ID using the # in CSS code this code is not applied.

Wait until this big is solved (SC is aware of this bug and solving it) or use a workaround. The workaround is replacing the # by chr(35). See below.

echo'
<style>
'.chr(35).'id_sc_dragdrop_foto{
display: none;}
</style>';