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

[UPDATE] Image Upload & Thumbnail

Quote Reply
[UPDATE] Image Upload & Thumbnail
I'm in the process of reworking all the plugins. It should only take a few days, but when done, I'll have several additional modules, as well as more standardization between them.

I'm breaking the &make_thumbnail routines into their own module Thumbnail.pm, which can then be called from almost any other module you'd want to. I'm just trying to figure out what the minimum number of parameters needed are, and whether to make it a module with built in defaults that can be overridden, or to make it a plugin, with it's own configuration file.

The UploadLogo program will now be able to make use of this module to automaticaly thumbnail the uploaded logo to make it conform to the size limits. The next release will have this capability, if Thumbnail.pm is installed.

I'm going to hold off sending out new copies of the MultiUp for a couple of days, till I get this all settled down. No interface changes should be made (database, or configuration files) but I am making major changes to the templates, and I'm integrating the UploadLogo into the whole package, so from the git go, you'll have a means to attach an image/thumbnail/logo to the "Link" as well as attach files to the link with automatic thumbnailing.

1) I will maintain the Logo/Graphic mods for people who only need this fucntionality.
2) If you need both a logo and a body attachment, I'd suggest going with the MultiUp program, which will include a logo feaure, as well as body attachments.
3) Availability of a "Thumbnail.pm" which will allow the addition of thumbnailing to almost any plugin.

Also, this restructuring will allow you to add code fragments (subroutines) to either MultiUp.pm or Utils.pm, and then call them as <%path::to::subroutine%> in the templates to make major changes in the look of the output.

The advantage of this, is that if you modify the <%Plugins::MultiUp::get_attachments%> routine, to return individual image tags such as <%slot1%>, <%slot2%>, etc, you can do in-line formatting, rather than list format. You can change the look of the formatting, and more, with very simple customizations, and template changes.

I really love this stuff!

A practical note: The heavy development has put a strain on my server, and I need to make a major upgrade to continue developing at this rate. If you have planned on purchasing, or pre-ordering, now would be a good time! A 256 meg upgrade is almost $1000! (Yeah, I know, but it's a Sun Sparc, and I need to do more than just a RAM upgrade.)



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Quote Reply
Re: [UPDATE] Image Upload & Thumbnail In reply to
Actually, the breakup into an Image:: subdirectory went pretty well.

Because most of my programs will be dealing with Images, I've set up a subdirectory:

Plugins::Image

Where I've got

Plugins::Image::Utils
Plugins::Image::Thumbnail

and I think it might be a good place to put

Plugins::Image::Upload

as well.

I don't want to start a mushrooming of subdirectories, but I might also add a:

Plugins::File

subdirectory, and add the general file utilities to that.

In which case, I'll have:

Plugins::File::Upload
Plugins::File::Move
Plugins::File::TempDir

etc.

If these are generalized enough, then other plugin authors will be able to take advantage of them, and save some development time.

At the moment, these are specific to the MultiUp plugin, and use it's configuration file. I saved about 10 hours of work doing it that way, at least at first.

The good news is, that the interface so far has been robust enough, that simply re-installing this new plugin module over the old one works. No changes to the data structures. Only a few new files and subdirectories added to the "invisible" tree.

But, there are template changes, and I'm still trying to figure out how to handle those.

How does:

1) The install program looks for all the templates it's going to change, in the "default" directory.
2) It creates a subdirectory with the version number of the new install, and moves those files into it,
3) Then copies the new templates to the default directory.

This way, your old templates are saved, so you can add them back in, but the new templates are in place, so all the features work.

Keep your fingers crossed and I'll have the beta 2 released by saturday, with all these new features, and back-end fixes in place.

In case anyone is interested, this is the fairly incomplete change log for the beta 2 so far. I add to it mostly things I want to remember, not every change made.

=== Change log ===

03.01.01 beta 2

-- Still pretty Unix specific, I have no way to test under NT
-- added USER_ADD_FIELDS and USER_MODIFY_FIELDS, missing from the beta 1 install
-- MultiUp.cgi over 2,000 lines, and growing -- needs breaking up.
-- first steps to creating oop module, routines broken up into method parts and calls.
-- broke out Template.pm
-- broke out Utils.pm
-- created new Image:: subdirectory, for module grouping
-- regrouped many routines, rearranged the multi_upload routine
-- regrouped add_attach
-- changed some install default values
-- added &check_file_size
-- added &get_user_add_fields
-- added &get_user_modify_fields
-- added &check_directory_list
-- added Days_Old - link_Days_Old and AE_Days_Old to MultiUp.pm (replaces Days_Old plugin)
-- $attach_dir now used to denote the Link directory ATTACH_PATH/LinkID
-- TEMPDIR code attached, set during set up
-- added $create to the &check_directory
-- &multi_upload_file no longer uses $IN for any values.
-- started change to File::Copy (not in image routines yet)
-- added Table Edit to plugins menu
-- template changes in Multi_attach.html and link_element and element to accomodate directory changes
-- bug fix to Multi_attach.html, duplicate code removed
-- template changes to stream line the flow of data
-- fix to &check_directory
-- added LinkID parameter to &make_thumbnail to create the proper subdirectory
-- additional tempdir fixes and updates
-- more generalization changes for reusable modules
-- started "Text" file checking and escaping
-- started moving file procesing options into Plugins::File modules

=== end ===


PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin