Gossamer Forum
Home : Products : Gossamer Links : Discussions :

image (file) upload and image call 2.05

Quote Reply
image (file) upload and image call 2.05
I have figured how to use the upload file feature of LinksSQL 2.05, but I can't seem to figure out how to call it on a page. I have two images, a thumbnail that I want to call on the category page, and a full size on the detailed page.

I'm sure there is some simple syntax, I just don't know it. And yes, I've done a search, but the results were thin and somewhat confusing, since this is a new feature and some of the search results were from hacks.

Perhaps you can tell me how I'd call an image I have uploaded via adding a column for files in the database?

Also, in addition, what would the regex be to limit the file uploads to .gif and .jpg files? :)

One more thing :) Should I hash them or not? and why?


Quote Reply
Re: image (file) upload and image call 2.05 In reply to
Ok, after re-searching the forums again, I found a snippet that works. But, I am curious what it actually does, and if this is the best way to call the image.

I don't know why this works, but it does seem to work:

<%if Image2%>
<img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&view=Image2">
<%endif%>

can someone explain what this is doing?


Last edited by:

Evoir: Sep 10, 2001, 12:53 PM
Quote Reply
Re: image (file) upload and image call 2.05 In reply to
 
Ok,

I'll admit first I don't have a working system yet, since lots of things have gotten in the way, and I'm starting a new network from scratch with 2.05 so that I don't get any "features" confused between all the older versions and mods, and the current, stable release (soon to be 2.1 ??? :)

Anyway, what Alex did with the uploads is "assume" they would be stored in a non-public directory. Jump.cgi will find the file, and output it as a MIME (or HTML/IMGE/etc) stream, so the browser knows what to do with it. This allows images to reside in "restricted" areas. It works similar to an advertising program serving banners into an HTML page.

I haven't played with this fully, but it's fundamentally different than what most people are used to, or probably are really looking for in content delivery.

If you are uploading images, and want to keep them in your public tree, you can use standard IMG SRC tags.

Otherwise, think in terms of "banners" and you'll probably catch on :)

Because of my accident, and limitations, I'm considering making my mods, or partial mods available for public download, with the stipulation that any changes or fixes are posted here and/or to me.

I've approached Alex about this, so that the Logo, Graphic, and Image Upload mods I have (which are a superset of what GT has in the program now), along with the multiple file attachment mod, which uses a different approch than GT, but will overlay pretty well can maybe be incorporated into Links.

If this happens, everyone who bought the mods from me will know they contributed to it, and those who purchased the smaller mods, will get some help setting them up. Everyone who purchased the full-system, will still get that image management program once it's done, and maybe more. I am still building that, and it's built on the basis of the smaller mods (widgets).

I should have a "virgin" 2.05 set up in a day or two, and will merge the Logo/Graphic mod into it, using the built in file fields if at all possible. This doesn't use the jump.cgi, and assumes images are in the public tree. Because of how this works, it should be possible to have data fields that are "public" like logo images, and data fields that are server-served-only, such as paid content.

Some of you know the details of my situation, but most don't, and all I can say is I'm sorry it's shaken out like this, right when things were ramping up, but right now all I can do is try to make the best of what's now. I should be back to daily message answering, and code snippets now, but my ability to do heavy duty programming (typing) is limited.



PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: image (file) upload and image call 2.05 In reply to
Thanks Pugdog.

I tried calling the image like this:

<%if Image2%>
<img src="<%image2%>">
<%endif%>

and I get a broken link. My images are stored in a web accessable directory. I guess I can continue using:
<%if Image2%>
<img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&view=Image2">
<%endif%>

Some additional questions about the default file upload available in Links 2.05:

1) Since the above <img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&view=Image2"> seems to be working. What are the drawbacks to using this method?

2) Should I be using HASH in this column?

3) What regex should I use to allow only .jpg and .gif file under 25 k to be uploaded?


Thanks again!

Quote Reply
Re: image (file) upload and image call 2.05 In reply to
 
<%if Image2%>
<img src="<%image2%>">
<%endif%>

You need to give it the URL to the image, not the path....


> 1) Since the above <img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&view=Image2">
> seems to be working. What are the drawbacks to using this method?

Server load... extra cgi calls, things that are run as scripts that could be simple 'fetch' calls by the server....

> 2) Should I be using HASH in this column?

Yes/No ... it shouldn't make a difference in serving the images.

> 3) What regex should I use to allow only .jpg and .gif file under 25 k to be uploaded?

Size needs to be checked by a script, so you couldn't do that with a simple regex.

Your situation seems perfect for what i designed the Logo/Graphic mod to do, which is attach an image in the public tree, and display it as a simple <img src> tag.

I think Alex was trying to find a general solution for cross-product support in GT software, but over looked what people were trying to do with their sites with Links SQL specifically.

As I've posted several times in the other forums, this file upload/attach issue gets very complicated, very complex, and very regressive/recursive if you start working with it.



PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: image (file) upload and image call 2.05 In reply to
Thanks again Pugdog,

You wrote:
<%if Image2%>
<img src="<%image2%>">
<%endif%>
You need to give it the URL to the image, not the path....
----------
I don't know what the url to the image would be as it is dynamic, no?

I have tried giving it a relative link like this:
<%if Image2%>
<img src="/imageuploads/<%image2%>">
<%endif%>

to no avail. Can you give me an example of the way i would call it?

Also (for anyone else who is looking):
I found the regex info in another thread: Alex wrote
'^|.*\.(gif|jpg|png)$'

should allow gif, jpg and png files. :)

Last edited by:

Evoir: Sep 10, 2001, 1:54 PM