Gossamer Forum
Home : Products : Gossamer Links : Discussions :

[HELP] :: How to display User Image/Logo uploaded during Account Creation.

Quote Reply
[HELP] :: How to display User Image/Logo uploaded during Account Creation.
I was wondering if someone can help me out with this issue.

On our site, users are allowed to upload their picture or logo, which will be displayed along with all the listings they submit to the site.

Here is how I created User Picture field:

Column Name: UserPic1
Column Type: VARCHAR
Column Index: None
Column Size: 255
Column Value:
Not Null: No
Default Value:

Form Display: User Picture 1
Form Type: File
Form Size: 20
Form Names:
Form Values:
File Save Location /home/user/public_html/userpics
File Save URL: http://www.domain.com/userpics
File Save Method: HASHED
File Maximum Size: 50000
Form Regex: ^([%\w-]+\.(?:jpe?g|JPE?G|gif|GIF|png|PNG)|)$


In addition not every user will be having an image. So does anyone have an idea on how do I display User Image on Detailed page?

Thank you for the help.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
Hi,

Not positive but this should work.

<%if UserPic1 %><img src=<%UserPic1 %>><%endif%>
Quote Reply
Re: [rascal] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
It does not work :(

Also, UserPic1 is part of User Property/table and not link table.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
Use it like you would use any other file column? http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=292819

Adrian
Quote Reply
Re: [brewt] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
Hi Adrian,

I tried that method, however either I am missing something or it don't seem to want to work.

Small Clarification:
1) I am having upto 10 images for Link, and am using <img src="<%db_cgi_url%>/jump.cgi?view=FILECOLUMNNAME&ID=<%ID%>"> to display listing, without any Global. This seems to work just fine.

2) Every user is also given an option to Upload their Logo/Picture within their profile (User Column), along with username, password, email.... while registering on the website.

Here is what I am trying: To be able to display User Logo/Picture on every listing submitted by that particual user. This is in addition to the image upload feature for Link.

I tried
Quote:
<%if UserPicture%>
<img src="<%config.db_cgi_url%>/jump.cgi?ID=<%ID%>;view=UserPicture" alt="" />
<%endif%>
However it don't seem to help at all.

I added following global : filecol_url
Quote:
sub {
my ($col, $id) = @_;
return $DB->table('Links')->file_info($col, $id)->File_URL;
}

However received following error:
Quote:
A fatal error has occured:
Can't call method "File_URL" on an undefined value at (eval 38) line 3.
Please enable debugging in setup for more details.

Vishal
-------------------------------------------------------

Last edited by:

SWDevil.Com: Aug 12, 2007, 10:28 PM
Quote Reply
Re: [SWDevil.Com] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
Hi,

Are you using right table?

If I understand right user image is uploaded in Users table?

If this is right then this: return $DB->table('Links')->file_info($col, $id)->File_URL;
should be:

return $DB->table('Users')->file_info($col, $id)->File_URL;

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
Yeah I tried changing global to return $DB->table('Users')->file_info($col, $id)->File_URL; but no success :(


And yes, when I change Links to Users, it don't show the error. But don't display the image either.

Vishal
-------------------------------------------------------

Last edited by:

SWDevil.Com: Aug 12, 2007, 11:28 PM
Quote Reply
Re: [SWDevil.Com] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
Hi,

You need a global:

Code:
sub {

my ($ID,$field) = @_;

my $table = 'Users';

# make sure a fieldname and ID are provided...
if (!$ID || !$field) { return "You need to define the ID and fieldname. Example: &lt\;%Plugins::Thumb_Images::ThumbURL(\$ID,FieldName)%&gt\;"; }

# get the actual path to where the file is/will be saved...
my $schema = $DB->table($table)->cols;
my $path = $schema->{$field}->{'file_save_url'};
$path =~ s,/$,,; # get rid of trailing / at end of $path

# now we have the highest ID, lets get the image stuff for this link.
my $col = $field; # column name where file is held
my $tbl = $DB->table($table);
my $fh = $tbl->file_info( $col, $ID ); # return a glob reference to the file that you can print <$fh> if you want
my $rel_path;
if ($fh) {
$rel_path = $fh->File_URL;
} else { return; }
undef $fh; # explicit close of the filehandle for good measure

$rel_path =~ s|([^\/]+)$|GT::CGI->escape( $1 )|e;

return $rel_path;

}

..and then call with:

Code:
<%global_name($LinkOwner,'ImageFieldName')%>

...so a proper formatted bit of code would be:

Code:
<img src="<%global_name($LinkOwner,'ImageFieldName')%>" />

Obviously $LinkOwner would be the case where its available.

Hope that helps.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
It worked :)

Thanks a lot Andy, your help is very much appreciated.

Thank you again.

P.S.. First I thought I might need that Thumb plugin, but it worked without it.. sweet.

Vishal
-------------------------------------------------------

Last edited by:

SWDevil.Com: Aug 13, 2007, 3:20 AM
Quote Reply
Re: [Andy] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
Hi ANdy,

I am getting this for image location of the image, and the image is not being shown on detail page

http://www.mywebsitecom/Detailed/

any clue?
Jason Bishop

Last edited by:

netnow: Nov 25, 2007, 1:12 PM
Quote Reply
Re: [netnow] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
Hi,


Erm, I'll need a bit more info than that to try and work out why its not working :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
Hi Andy,

This is the problem. I have added your gloabl and inserted the code above.

When i try to add the user image on detailed page in Signup_form, the images do not show

However when i create the user page (with upload form)in the admin panel, IT WORKS?

So the problem is got to be on the Signup_form Page

hERE is my code for the signupform page

<div class="row clear">
<label for="RealtorImage2" class="name">Realtor's Image: (200px MAX Width)</label>
<div class="value">
<input type="file" id="RealtorImage2" name="RealtorImage2" value="<%if RealtorImage2%><%escape_html RealtorImage2%><%endif%>" class="text" />
</div>
</div>

Is there anything wrong here?
Jason Bishop

Quote Reply
Re: [netnow] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
I got it,
ineed to add

enctype="multipart/form-data"
to my form



IS there anyway to be ableto put a form on another page?
Jason Bishop

Quote Reply
Re: [netnow] [HELP] :: How to display User Image/Logo uploaded during Account Creation. In reply to
netnow wrote:
enctype="multipart/form-data"
to my form


Yup, that helps Angelic

Quote:
IS there anyway to be ableto put a form on another page?

Not sure what you mean?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!