Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Image in detail pages...HELP

Quote Reply
Image in detail pages...HELP
I'm a bit frustrated and confused. I've searched the forums in regards to how to have a specific image show up in links. I've encountered a "thousand" ways to do it. I'm looking for one generic and accepted way to do this. Re: Manual, I have created a new image field via Table Editor called "Images". My images directory on my server is dir/files/images. I want the image to show up only on my Detail page for that link.

1) Do I have to modify link.html? if so what would be the insert?... <%if Images><%Images%><%endif Images%>...is that correct?
2) I know that I have to modify Detail.html...what do I insert there?...<%Images%>...is that correct?
3) Do I need a global? If so what would be the Global code?

If this question is repetitious please excuse me, but I need the most recommended way to do this.

Thanks in advance!
Quote Reply
Re: [Royce] Image in detail pages...HELP In reply to
Hello Royce,
  1. If you want the image to appear only on the detailed page, you *do not* need to modify link.html
  2. <%if Images><%Images%><%endif%> should do the trick.
  3. You do not need any global for what you are trying to do. Also, along with one or any number of images, it is very easy to insert any type of image/text on detailed page in Links SQL. Just add a column in link property and use the column tag in the detail.html page and you are done.

Hope this helps.

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [NeedScripts.Com] Image in detail pages...HELP In reply to
Quote:
<%if Images><%Images%><%endif%> should do the trick.

Erm, you do Wink

If just adding a "URL" field (i.e the URL to an image), its as simple as just adding a new text field.

However, If you are going to be uploading it to your server, via the admin panel, your best bet may be my Thumb_Images plugin. Its not required, but makes a much more long winded process, a lot simpler (and also gives you thumbnails of those images Smile).

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: [Royce] Image in detail pages...HELP In reply to
Gentlemen,

Thanks a bunch for responding to my post. Ok, I did exactly what you suggested, however, for some reason Links SQL is creating a folder inside my images file folder and named the folder "1". The image in question is inside "1". For this reason also the image is not showing up. What next?

Regards,
Royce

Last edited by:

Royce: Jun 19, 2004, 11:26 AM
Quote Reply
Re: [NeedScripts.Com] Image in detail pages...HELP In reply to
Hi Vishal,

Thanks for you comment. I added:

<%if Images%>
<%Images%>
<%endif%>

to my detailed page but a image is not showing up...only the name of the file is showing in its place.
Quote Reply
Re: [Royce] Image in detail pages...HELP In reply to
Hi Royce,

Andy has suggested a very good idea, you might also want to look into that. Also, I have been using Andy's plugin for long time and trust me, they are even better then what he says about them ;)

Quote:
o my detailed page but a image is not showing up...only the name of the file is showing in its place.


Oh.. sorry my mistake.. try this

<%if Images%>
<img border="0" src="<%Images%>">
<%endif%>

I hope Images column contains the entire path of the image on your server/website. If not, then you might want to update above src tag to something like:

src="http://www.domain.com/image-path/<%Images%>">

Also, remember, if you want, you can fix the hight and width of the image using the tags like width="150" height="150" along with the border tag.

Hope this helps.

Vishal

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

Last edited by:

NeedScripts.Com: Jun 19, 2004, 12:45 PM
Quote Reply
Re: [NeedScripts.Com] Image in detail pages...HELP In reply to
Hey Vishal,

Thanks, I applied your instructions...however, and I don't know why but when I upload a photo via admin for that particular link...it makes a a new folder in my images file folder and adds a number in front of the image name...like 1-Pony.jpg

I don't want to purchase a plug-in right now...maybe later. Do you know what going on here?
Quote Reply
Re: [Royce] Image in detail pages...HELP In reply to
Hello Royce,

I am not allowing users to upload the image, but upload them myself, so I assume it is simpler for me.

About new folder creation, I am not sure why, but it seems like one of the feature of Links SQL, as when you allow users to upload images of their own, it is very much possible multiple users would be uploading images with the same name and hence to avoid duplication, I assume this feature is added within Links SQL.

I would like to help more, however am unable to, as I have not experience the Links SQL feature of user ability to upload images. I would recommend you to wait little longer, there are many experts along with Andy on this board, who might be able to help you out and expand my knowledge about such functions too.

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [NeedScripts.Com] Image in detail pages...HELP In reply to
Thanks Vishal for taking the time to answer those questions. FYI, I uploaded the images via Admin. So it's doing it within the admin functions. But thanks again. I'll see if Andy comes about again.

Smile Royce
Quote Reply
Re: [Royce] Image in detail pages...HELP In reply to
Hey Royce,

If you are uploading the images on your own, they why not upload them in a folder outside of admin (for example in root/image/uploads/) and then use the tags above, it will work like a charm ;)

Hope this helps.

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [Royce] Image in detail pages...HELP In reply to
Royce, please read this post;

http://www.gossamer-threads.com/...i?post=251257#251257

I think Vishal is a little confused as to how you need to grab the images. You need a global, which will grab File_RelativeURL from the file itself (so it gives you a full URL, i.e http://www.yoursite.com/images/logos/1/45-logo.jpg).

Its a simple process once you've done it first time... but once its done, you shouldn't need to do it again :)

Hope that thread helps ... I'm gonna go eat my roast now :)

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] Image in detail pages...HELP In reply to
Hi Andy,

I hope that roast was delicious! I went to that particular post you suggested, copied the global as it is. Now the other question is...because it's not clear to me...what do I use to call the image. Is it still:

<%if Images%><%Images%><%endif%>

Sorry, but I guess I need a little handholding on this one.

Thanks,
Royce
Quote Reply
Re: [Andy] Image in detail pages...HELP In reply to
Andy, I also tryed this to call the images:

<%if Images%><img src="<%build_root_url%>/files/images/<%Images('Images',$ID)%>"><%else%><img src="<%build_root_url%>/files/images/default/ClearShim.gif"><%endif%>

and I only get a image place holder. If I click Properties of the placeholder I see this error:

http://www.mysite.com/dir/files/images/Error:%20Variable%20'Images'%20is%20not%20a%20code%20reference

Royce
Quote Reply
Re: [Andy] Image in detail pages...HELP In reply to
Hey Andy,

Thanks for pitching and correcting me.. I as really getting confused... and along with Royce, I will also carefully follow this thread to learn how it is done.

again, thank you for your help.

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [Royce] Image in detail pages...HELP In reply to
Ok, well, I'm gonna guess you already have the field setup ok, so it should just be a case of using a global;

Code:
sub {
# -------------------------------------------------------------------
# This subroutine will get called whenever a tag is called in the templates.
# It will grab the URL to the image...and return it
# Call with <%GetImageURL($ID,FieldName)%>

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

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

# get the actual path to where the file is/will be saved...
my $schema = $DB->table('Links')->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( 'Links' );
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 = $fh->File_URL;
undef $fh; # explicit close of the filehandle for good measure

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

return $rel_path;

}

Then, call it with;

<%GetImageURL($ID,'Image1')%>

,.... where Image1 is your field name ($ID can stay as it is, because that is automatically set in link.html and detailed.html).

Hope that helps :)

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!