Gossamer Forum
Home : Products : Links 2.0 : Customization :

Image (photo) database MOD in the works. Anyone interested in helping?

(Page 1 of 2)
> >
Quote Reply
Image (photo) database MOD in the works. Anyone interested in helping?
I am currently working on building an image (photo) database catalog using Links 2.0 with Yahoo Mod. The code is being tweaked & slowly coming together. If anyone has any input on using various image tags in Links, please feel free to contact me or add your ideas to this Post.
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
You may see a working demo of my progress at the following link.

http://server14.hypermart.net/...heworld/links/pages/
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
Where do the actual images reside? Does the user upload the images to your server?

Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
The images reside on the submitter's server. Thumbnail links and image links have been configured to pick up the image via standard URL calls.

I am also pondering the thought of adding user upload features so they can add images directly from any hard drive. This will require a substantial amount of server storage space, though. Don't know if it would be feesable for a FREE database.

If anyone knows how to add an image call tag directly to Links.def, please post.
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
Well, if the images reside on their server - then there is a mod already for this. What I am looking for is a situation where one can upload images to our server and then we can link it. I am talking about the people who do not have a site or do not know how to use computers. Say for example, if you want to create a personals database then all they need to do is to upload the image to your server.

There is a guy with a baseball game site, who has added this capability but never replied with instructions on how to do it.

Here is how to do it if the images stay on their server.

Add these two links.def

Logo => [30, 'alpha', 0, 5, 0, 'No', ''],
LogoURL => [31, 'alpha', 40, 100, 0, '', ''],

then in site_templates_html.pl
in sub links or detailed add

# This mod is for the logo image display

my $logo_gif = "";

if ($rec{'Logo'} eq "Yes") {
$logo_gif = qq|<a href="$db_cgi_url/jump.cgi?ID=$rec{'ID'}" target="_blank"><IMG SRC="$rec{'LogoURL'}" WIDTH="" HEIGHT="" ALT="sponsored logo" BORDER="0"></A>|;
}
else {
$logo_gif = qq|<a href="/logo.html" target="_blank"><IMG SRC="/links/images/misc/yourlogo.gif" WIDTH="" HEIGHT="" ALT="standard image" BORDER="0"></A>|;
}

# end logo mod

Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
socrates,

I'm also looking for a mod to allow an image upload to my server. I'm hoping that Alex will be able to share the method he uses to allow file uploads in the Resource Center. I've started a thread about it, so now I'm just waiting and hoping. Smile (because I know this is not something I can hope to do without help)

Phoenix
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
kjp-
From the looks of your page, all you are doing is adding images to the link listings, not creating a photo gallery. Have you looked at the Logo Links adaption to see if it covers what you want?
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
There is a little program I downloaded from the http://www.cgi-resources.com/ CGI Resources Index in the Perl/Image Managers section called Picture Archive. It is a simple Perl program used to upload images from the hard drive, and creates both a thumbnail gallery and a full-size image gallery. I got everything to work except the actual upload. I keep getting 500 Internal Server Errors. Emailed the creator for help.

If anyone is interested, try downloading it and see if YOU can get it to work.

Thanks for the input guys. I will check out the above mentioned Mods and code. BTW, I AM trying to make a full Photo Gallery. Just a beginner at this, so all your help is really appreciated.
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
kjp,

Actually, there are a couple of "file uploading" scripts also in the cgi-resources. Check'em out. I am not going to fool around with this now, since it is not a priority for me. However, if you succeed we would like to hear from you.
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
I'm modifying links to use photos as the link. I'm not currently allowing uploads, and I've always preferred images reside on our servers, since you can't always count on the other server being up, being speedy, or otherwise responding -- it makes you look bad. If their link doesn't respond, it's bad enough, but your page shows broken images, and takes forever to load, it's even worse.

I've always chosen to serve images from my server, whether they are banners, logos, or graphics.

I posted a request for info/help a few days back on where to make certain mods to allow images more easily.

You can check what I have working so far at http://www.postcards.com/links/pages/

Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
pugdog,

Your site looks great! How did you modify links to include the photos? I'm trying to do a similar thing with a classified site. Any advise you can give would be appreciated...
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
Ok, I've got the basics of the image/file upload mod working. You can see it at
http://retroworld.hypermart.net/linker/pages/ .

Sorry, Bobsie, about posting the new thread
http://www.gossamer-threads.com/...um3/HTML/002580.html on this subject. I forgot about this thread that I'd already started.

Anyone in the mood to help perfect this program so that it works more automatically is welcome. Would like to be able to have more control of image sizes, file upload sizes, etc. And want the upload to be more script-oriented, instead of cut & paste (like it is now).

I have a feeling that a script mod like this could have a zillion uses. Dasting services, product catalogs, etc? I've also tried to incorporate a shopping cart script in it but can't get it to work, YET!

Input??? Scripts are not protected yet. View them at http://retroworld.hypermart.net/linker/
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
One more thing....
Since I've left the protection off for y'all to experiment...PLEASE DON'T ABUSE MY SCRIPTS!!! No PORN, RACIAL STUFF, ETC! If I find any of it, protection will be ON.
Thank you.
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
Including the photos was easy. It's just a database field. I used the Logo Links mod as a guide, and works fine.

I have 2 urls -- one to my link (the full image) and one to the thumbnail. I really don't need that, since I place the thumbnails in the same place relative to the main photo for ease.

What I have been trying to do, from the admin screen, is upload a photo, have a thumbnail generated, and the height/width inserted into the database. The thing that has held me up is selecting the Unix file location for the file, since I don't want them all in one directory -- or if they all get uploaded to one directory, I'd like them automatically moved to the appropriate subdirectory on validation (for housekeeping reasons).

Now GD can grab the ht/width and I have a great little script program that uses ImageMagik to make thumbnails, but I've not been able to integrate them all. I really should.

The upload script is basically using CGI.pm and that is now included in the basic perl install. You can grab 2 or 3 different examples of ucing cgi.pm from cgi-resources in the image upload area.

If anyone is seriously interested in doing the mod, I'll give the specs, and and will be able to try it out on a fully working site.

There are some great things out there, but I don't like 'hacks' and would like to see this as a full blown mod that could be easily ported to the SQL version.

I have to prioritize my mods, since I don't have a local unix box, I do everything via telnet, and it's a lot slower for debugging.

I would start with adding this feature to the admin.cgi routines, since they will have to be added there eventually, at they will be out of site until debugged.

The URL field and Thumbnail field should be upload [browse] boxes. You should be allowed to pick the file from your disk, and the upload location (from a pick-box for security).

On my site, I'd like to upload the main image, and generate the thumbnail in a 'thumbnail' directory off the subdir that the main image is stored in. This allows images to be called by:

servername/filepath/image

and the thumbnails by:

servername/filepath/thumbnails/image

And works great for templates and portability.

I've carefully thought this out, and gotten all the puzzle part, but haven't put them together.

I realize mods take time, but I'm somewhat discouraged by the recent announcement to charge for mods, when the ideas and help to generate them is often freely offered.

Anyway.... this is a start, let me know Smile
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
Pugdog,
I really think your site is well-thought. I'd be interested in working with you to develop the image upload Mod.

Could you explain, again (sorry), the details on automatically resizing the uploaded images? I've set the image tag so that all images on my catalog pages are only 45 pixels wide (to make uniformity) but that doesn't solve the problem of large images being stored on my server, not to mention the time it takes to load a page full of 100k images.

I know there are programs out there (I've tried them) that will auto-generate thumbnails and an image gallery, but I've had a problem incorporating the programs into the script. With the program I use for uploading (Upload.pl) you can probably specify different directories or just run separate scripts for each directory you want the images sent to. No prob, there. It would be nice to be able to run the upload through a program like they have on the GifWizard site (ala Link Exchange). It automatically resizes the images to the set width, height and file size.

Feel free to jump in here, anyone....
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
One more thing....
Does anyone know if it is possible to incorporate a Windows executable program (or actually run one) through or on a Unix server?

If not, is it possible to run an exectutable program on the web at all? If so, how?

I don't mean something you have to download first. I mean, a program that actually starts running and allows interaction when you click 'START'.
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
  
I have to clear my head and pull those files out again.

One program to check out is at:

http://www.watson-net.com/

in their cgi area. It shows how to do a few neat things.

Another program is at:

http://www.nihongo.org/snowhare/utilities/htmlthumbnail/

This program can be fed the original image, some parameters, and generate a very pretty thumbnail in a different directory -- you just need to feed it complete path data, otherwise it assumes relative and is unpredictable. IT's not a CGI program, but can be executed via telnet or from another script.

Ideal would be to browse the harddrive, see a preview of the image file, click "Ok" to upload it, then have it resized and made into a thumbnail, with the Ht/Width for both the original and thumbnail inserted into Links.

Another use would be if H/W exceed a parameter, or if overall file size exceeds a certain size, re-size it with higher compression, and re-present it to the user to OK -- just like LinkExchange.

Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
Ok Pugdog,
I uploaded the HTMLTHUMBNAIL program you mentioned above. Placed it in a directory of its own and renamed it htmlthumbnail.cgi (wrong?). Now, my question is....how do I call it into action??? Help, Please.....
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
What do you mean how to call it?

You should see what it can can do by calling it from the command line (telnet). To call it from a CGI call, you have to put a system call in. Something like:

Code:

my $htmlthumbnail_script ='/full/path/to/htmlthumbnail';
my $working_dir = '/filepath/at/some/location';
my $new_graphic_file = 'file.ext';
chdir $working_directory;
system($htmlthumbnail_script,'-update',$index_file,
'-output',$index_file,
'-link',1,
$new_graphic_file);

Should work.

You can use whatever other parameters you need. The author was helpful with this, he's just too busy to do anything on the program now. (Had some other questions for him, like page spanning, and # of images per row -- for other uses).

This still only only solves one set of problems. Still need to grab the sizes of the files and insert them, in order to have more rapid page loading. That is my biggest problem at this point with my site, is that because of the odd sizes (even a few pixels makes a difference) I can't pass Ht/Width tags. And MSE really pukes if you pass a Ht or Wd tag of "".

Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
Oh... you really don't have to be _in_ the subdirectory as long as you pass FULL UNIX PATHNAMES to the program. I run it from my cgi-bin directory, just pass full paths.

Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
 
Quote:
Does anyone know how to render an image so that it is a specified width/height without affecting images that
are already smaller than the dimensions specified? For example, I tried setting the preview image on my pages to
render a 150 pixel wide image max, but it takes the smaller images and expands them. Not too eye-pleasing.

This is from the other thread... I alluded to this with the MSE problem. Because of that, I had to eliminate the Height/Width tags completely, since a null value did strange things. I guess I could have used an <if> check, but it would have been unweildly.

The reason for the two scripts I showed you, is that they can pick the Ht/Width of the image.

To then maintainformatting, you insert that into a table:

<TABLE BORDER=1 BACKGROUND="" CELLPADDING=5 CELLSPACING=0>
<TR><TD VALIGN=MIDDLE ALIGN=CENTER BGCOLOR=BLACK BACKGROUND=""><IMG SRC="...."......></TD>
</TR></TABLE>

Putting the </TD> after the <IMG> tag is very important for formatting.

You need to consider this a GDE (Graphic Design Element) and if you are already using tables, you need to insert this where you'd put the <IMG> code. What this does is center the image inside a one cell table against a 5 pixel black border (looks pretty good for most things). The null background tag overrides any backgrounds that might have been set, and is a bug in Netscape (?) If you use complex nested tables you'll know what I mean...

You take this design element, and you put it into another table. This outer table is the one that determines your page layout -- in your links.html and detail pages.

NOTE: the width you use on the outer table is based on how your page is laid out. It can either be a % or an absolute.

<TABLE WIDTH=400 BORDER=0 CELLPADDING=3 CELLSPACING=1 BACKGROUND="">
<TR><TD VALIGN=MIDDLE ALIGN=CENTER>
<!-- insert Image GDE above here -->
<!-- you might want to VALIGN=TOP in stead of MIDDLE -->
</TD>
<TD VALIGN=MIDDLE>
<!-- insert rest of your link data here -->
<!-- this is the text, new, updated, etc portion -->
</TD>
</TR></TABLE>

You can put some data such as hits/votes/etc in other rows, just make sure you span either the ROWS or COLUMNS depending where you want to place it.

Hope this helps.

Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
 
Quote:
The null background tag overrides any backgrounds...

Holy *&^%! So that's how you get around it! You just made my day pugdog Smile Smile Smile Smile
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
One other resource gem for picking, is to take a look at the program:

http://www.webmin.com/

It's a monster program for allowing pretty secure remote server admin via a root-priv server. Particularly the File Manger, that uses JaVa to provide a graphical upload/download display. This can overcome MANY of the problems we've been talking about.

Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
Pugdog,
From your earlier post.....
Quote:

code:


my $htmlthumbnail_script ='/full/path/to/htmlthumbnail';
my $working_dir = '/filepath/at/some/location';
my $new_graphic_file = 'file.ext';
chdir $working_directory;
system($htmlthumbnail_script,'-update',$index_file,
'-output',$index_file,
'-link',1,
$new_graphic_file);

I'm not very adept at Perl programming yet, so this may sound real stupid. Where would I place the system call you refered to? I'm familiar with SSI and HTML calls, but system calls? Maybe this is still over my head? Should I stick to something simpler? Or can you put this is non-programmers jargon?
Quote Reply
Re: Image (photo) database MOD in the works. Anyone interested in helping? In reply to
Code:
chdir $working_directory;
system($htmlthumbnail_script,'-update',$index_file,
'-output',$index_file,
'-link',1,
$new_graphic_file);

The call is right there. This code snippet actually works (the one I posted). You just have to set up the variables, and call it.

system() is a call to execute an external process. It's _VERY_ dangerous with user input, hence all the routines to scrub input of funny characters, but if you are calling it from inside your cgi script with your own parameters -- it's pretty safe.

This is where the perl "taint" checking comes in. If a variable is tainted in anyway your program will produce an error for you.

> >