Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

[PROBLEM] : Displaying Image from USER Table field on Detailed page

Quote Reply
[PROBLEM] : Displaying Image from USER Table field on Detailed page
Hey Andy,

I am using your Global (mentioned @ https://www.gossamer-threads.com/forum/Products_C9/Gossamer_Links_C5/Discussions_F18/Re%3A_%5BSWDevil.Com%5D_User_Info_on_Detailed_Page_P297982/#p297982 )

However it's not working, any idea what is going on?

----------------------------------------------------------------------------
Info being used is as below
----------------------------------------------------------------------------
I have created a New Table under USER PROPERTIES & am trying to display logo uploaded on USER PROFILE on to Detailed page of all links owned by the user.

Name of User Table field:
user_logo

Global Name:
user_logo_image2

Global Code:
Code:
sub {
# https://www.gossamer-threads.com/forum/Products_C9/Gossamer_Links_C5/Discussions_F18/Re%3A_%5BSWDevil.Com%5D_User_Info_on_Detailed_Page_P297982/#p297982
# Call it as: <%global_name($LinkOwner,'FieldName')%>
# Example: <%global_name($LinkOwner,'Address')%> (assuming 'Address' is an actual data table property in USER Properties Tables)

my $User = $_[0]
my $field = $_[1];
my $hit = $DB->table('Users')->select( { Username => $User } )->fetchrow_hashref;
my $Name = $hit->{$field} || "None";

return $Name;

}

Calling it using:
<%user_logo_image2($LinkOwner,'user_logo')%>

Please help.

Thank you.

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

Last edited by:

VishalT: Jan 28, 2021, 3:02 PM
Quote Reply
Re: [VishalT] [PROBLEM] : Displaying Image from USER Table field on Detailed page In reply to
& the error I am getting is:

Code:
Unable to compile 'user_logo_image2': syntax error at (eval 42) line 7, near "]
my "
Global symbol "$field" requires explicit package name at (eval 42) line 7.
Global symbol "$User" requires explicit package name at (eval 42) line 8.
Global symbol "$field" requires explicit package name at (eval 42) line 9.

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] [PROBLEM] : Displaying Image from USER Table field on Detailed page In reply to
I noticed that in UltraGlobal below options are available:


This function lets you grab the URL of an image (for a FILE type field). You need to invoke it with:

<%Plugins::ULTRAGlobals::Get_Image_URL($ID,'FieldName','TableName')%>

So, if you have an image field in your "Links" table , called "Photo" - you would call it with:

<%Plugins::ULTRAGlobals::Get_Image_URL($ID,'Photo','Links')%>

So, a fully formatted request - would look something like this (to actually show the image, not just the URL);

<%if Photo%>
<img src="<%Plugins::ULTRAGlobals::Get_Image_URL($ID,'Photo','Links')%>" />
<%endif%>
------------------------------------------------


However, all these seem to be for link properties & not for showing uploaded images on user profile.

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] [PROBLEM] : Displaying Image from USER Table field on Detailed page In reply to
BTW I do have UltraGlobals Installed,

So as suggested @ https://www.gossamer-threads.com/forum/Products_C9/Gossamer_Links_C5/Discussions_F18/Re%3A_%5Bnetnow21%5D_User_Info_on_Detailed_Page_P300715/#p300715

I tried adding below for testing:
Code:
Get_Image_URL
<img src="<%Plugins::ULTRAGlobals::Get_Image_URL($ID,'user_logo','Users')%>"><br><br>

However it does not work either, it's output is:

Code:
Get_Image_URL
<img src="//-"><br><br>

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] [PROBLEM] : Displaying Image from USER Table field on Detailed page In reply to
Code:
<img src="<%Plugins::ULTRAGlobals::Get_Image_URL($Username,'user_logo','Users')%>"><br><br>

or if you are trying to get the image for the LinkOwner:

Code:
<img src="<%Plugins::ULTRAGlobals::Get_Image_URL($LinkOwner,'user_logo','Users')%>"><br><br>

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] [PROBLEM] : Displaying Image from USER Table field on Detailed page In reply to
Wow.. that was so a simple way to get it done & works perfectly.

Thanks, Andy :)...

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