Gossamer Forum
Home : Gossamer Threads Inc. : Custom Modification Jobs :

Logo Graphic Upload / Display mod

Quote Reply
Logo Graphic Upload / Display mod
I have a pretty working Logo_Graphic upload & dsplay mod. It's plug-in compatible, meaning it's using the same plug-in config file that the larger mod will be using. It is not an automatic install yet, I'm hoping soon.

It _DOES_ require you to install Image::Size (available from CPAN).

It takes a field you specify (default is Logo_Graphic) and you add it to the add.html and add_success.html

You add a few lines to add.cgi, and copy the UploadFile.pm to the Plugins directory. You need to _CAREFULLY_ edit the Plugins.cfg file to add this as as recognized plugin. It's just a cut/paste, but you must do it carefully! (this uses no hooks, so it doesn't need to be "installed" per se -- but it's how this suite of modules will upgrade easily).

It checks the uploaded file for a Known type -- jpg, gif, png -- and if it passes, it checks the file size, to be less than the height/width you specify. (It can be set to allow any or all of those extensions).

It uploads to a temp directory you specify (use one out of the server tree, and you can erase any partial files there with impunity).

It then renames the file to ID.ext and moves it to the specified image directory.

To call the file you just use a tag <%image_directory%>/<%Logo_Graphic%>

Once you set up your templates, and fix add.cgi, the only updates to this program should be in the UploadFile.pm Just copy the new one over the old one.


Caveats:
1) I'm pretty sure this only works on unix at the moment
2) I 'mv' file, so the directories have to be on the same device.
(this will become the File::Copy command for portability)
3) It's probably got bugs, and no frills, but it's an alpha 1 release, and will go through a lot of changes.
4) This will remain a 'separate' mod, for people who just want to add a logo or small image to their links, and assign it a priority. (for now, just having a file name in the Logo_Graphic field can make it sort above others).
5) It will upgrade into the larger mods -- ie: upload any file, photo-gallery, etc.
6) It will allow your links to look like the http://postcardsportal.com in the featured supporters area.

Because most of the calls are hard coded, it only does one file at a time, and only allows one file per link, and is pretty much totally stripped of all the good features of the larger mods <G>, I'm going to put an "easy" price on this sucker of $25 with free upgrades. That means buy once, and you can download forever (as long as I keep working on the stuff). Figure, once it's finished, the only real changes will be if subsequent versions of Links require them.

In the future:
1) hopefully it will be a plug-in
2) it will allow user-modify and full managment solutions to the images.

Summary:

Module: UploadGraphic.pm
Price : $25 USD
Upgrades: Free
Features:
1) Upload a file to a specified upload directory, and attach it to the link via ID number.
2) Checks for a valid, known file type -- gif, jpg, or png -- and reads this information from the file itself _not_ the file extension.
3) Checks for file size, and can reject files that are too wide or too high.
4) unix only at this time
5) Will upgrade into the more robust packages


Coming Soon to this mod:
1) modify and delete the attached graphic file
2) install or upgrade as a plug-in
3) non-unix platforms to be supported


The larger mods will also add:
1) thumbnailing (resizing uploaded images)
2) gallery management
3) postcards script
4) non-graphics file uploads (text, sounds, pdf, etc)
5) multiple file uploads to each link
6) Files viewable by user (not only by link)
7) much more.


[Note: The upload puts the file into the images directory when the link is added, not validated. If you delete the validation, you'll have to delete the file manually for now (next version should get that). But, if you don't report the LinkID to the user until their link has been validated, there is no way for them to know the file name of the image to let people download it, so it's reasonably secure -- and how bad could an invisible small file be?]

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: Logo Graphic Upload / Display mod In reply to
cool, looks really good. Glad i have worked out CPAN, although extremley easy.

thanks pugdog.

http://www.ASciFi.com/ - The Science Fiction Portal
Quote Reply
Re: Logo Graphic Upload / Display mod In reply to
I can try to make the Image::Size optional, but it adds complications, and cuts out the minimal functionality of assigning the height/width tags and knowing the file size. It's much better than the shell pipes in NetPBM (IMHO).

perl -MCPAN -e shell
shell> install Image::Size


Is about all there is to it.

I have 90% or more of the script done. My last effor will be to package it as a plugin, that will install itself!

Thanks to Alex, the script has pretty full functionality, although I've tailored it specifically at a graphic/logo upload program. It adds several fields to the Links record -- Logo_Graphic, height, width and bytes. It requires you to make a few changes to your add and modify templates to handle the fields. But if tomorrow goes well, the rest of the "install" will be done by the plugin installer!! :) (I'm soooo happy!) (and dead tired....)

I should be able to make a "general" file upload that doesn't care what the file is, and just attaches it as an attachment-link to the record. Although I don't see the usefulness of that script except as a stepping stone to the full file-upload mod that allows graphics, thumbnails, and other files to be attached. The reason is -- you really want to have some control over what is attached to a link -- in some way. You'd like to know "what" the file is -- if it's a graphic, a binary file, a text file, or some other "known" type.

Please feedback! This is almost done!

Once it's done, it means the photo-gallery/image-post mod is not far behind!!

Alex has offered automatic distribution -- like with the other plug-ins, but until the "stable" version is out, I'm not bothering him about that.

For now, if you want this, email me, and I'll tell you how to get it.

I'll add a demo to one of the sites, so you can try it out.

Updated Summary:

Module: UploadGraphic.pm
Price : $25 USD (MC/Visa by fax, PayPal on-line).
Version Updates: Free; full $25 credit on package upgrades.
Features:
1) Upload a file to a specified upload directory, and attach it to the link via ID number.
2) Checks for a valid, known file type -- gif, jpg, or png -- and reads this information from the file itself _not_ the file extension.
3) Checks for file size, and can reject files that are too wide or too high or too many bytes.
4) should work on any system running links that can install Image::Size
5) Displays the graphic on the success and modify screens. (I'd like to get it to display in the Admin too... but don't know if that's possible.)
6) Free version updates -- and will upgrade into the more robust packages with purchase credit applied.


Coming Soon to this mod:
1) bug fixes ?
2) Features should all be in there



PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ