Multiline Test Mod - Interested?

Asked by Richard Virtue

Hello. I've been playing arround with this on my own web site and have made some modifications to your latest Creative Commons release if you're interested. The significant change (other than a few code "clean-ups") is the ability to create buttons with multiple lines of text. It's less than perfect and I haven't registered it here as a "branch" for that reason among others, but if interested, you can see the results at http://virtech.org/home/buttonmill/ or download my "experimental" package at http://virtech.org/home/buttonmill/buttonmill.zip

BTW, the latest release here seems to use !strcmp() in some rather strange ways and thus throws quite a few warnings, etc., when run on a dev server with PHP set to display all. I've revised a few bits in my own package for that reason just in case you're wondering why.

Question information

Language:
English Edit question
Status:
Answered
For:
buttonmill Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Eric Dennison (ericd-netdenizen) said :
#1

I've downloaded your experimental package and taken a quick look it - I like what I see (thank you!). Someone (me I guess) needs to bring the cleanups into trunk and generally organize it in a way that will make it (a little) easier for people to install. Since I won't be able to do this work for several months it might be worth registering your experimental branch with launchpad and letting them host it as well. If you don't feel like doing that i would be happy to do it anyway, just so everything can be found in one place.

Seeing the !strcmp usage really brings back the memories.. I think you're seeing the effect of many years of writing embedded C code.

Again, I'm THRILLED to see what you have done and it makes me very happy that I released this code in the first place (even though it wasn't code that I was necessarily "proud" of).

Revision history for this message
Richard Virtue (rvirtue) said :
#2

Thanks for your response. Glad you think that my "experimental" fiddling might have some merit. Personally I'm not entirely happy yet with the multi-row text alignment results. It will probably need an array and a loop process to really work well, which is one reason why I was hesitant about actually creating a "branch" here at this stage of my playing around with it.

I guess my reticence was also due to several other reasons: total unfamilarity with the Lanchpad environment, reluctance to make a long-term commitment, and not being sure what your own reaction might be as the originator. But with your kind encouragment, I'll give it some further thought.

In the meantime, if you are not "attached" to the retention of particular coding arrangements, I'd really like to go further with my revisions. For example, I'd get rid of most of those strcmp() items entirely and just replace them with simple == or != string and numeric comparisons. And I think I can probaby make the whole thing installable on almost ANY server with very few (if any) configuration items required. It's almost there now. It can certainly detect its own BASEURL, for example, and if any config requirements remain, I could create a separate config.php include file with its own self-documentation at the top.

Would that be okay with you?

Revision history for this message
Richard Virtue (rvirtue) said :
#3

P.S.: I've also cleaned up the HTML on my own site (mostly unclosed table <tr>s and <td>s) so that it conforms to current W3C standards. And I'll update the contents of the modified souce code download there as well.

Revision history for this message
Richard Virtue (rvirtue) said :
#4

Having said (above) that I wasn't entirely happy with my multi-row alignment, I think I have now found the correct formula and array handling loop so that text lines of varying length are now properly centered on the button, both vertically and horizontally.

The only limitation is that only background (centered) images are available when more than a single line of text is entered. Left and right positioning of images won't work with multiple lines of text.

Anyhow, if you're still interested, the complete package with the latest modifed code is available by clicking the download link at http://virtech.org/home/buttonmill/

Revision history for this message
Richard Virtue (rvirtue) said :
#5

Ignore that above-stated limitation on image positioning with multiple text lines. I've got it working now with a loop that adds or subtracts (right or left) $img_neww/2 for each $textline['x'] position and $maxwidth/2 (width of the longest text line) for the $img_x position.

The download package at http://virtech.org/home/buttonmill/ has been updated accordingly.

Revision history for this message
Richard Virtue (rvirtue) said :
#6

Well, seeing no objection here, I've gone ahead and split the buttonincludes.php file into two parts. ALL constants are now defined in a separate config.php file for easy setup and documentation thereof.

In fact, because the new config.php file auto-detects its own host server address and file pathname, there should seldom be any need for manual setup changes, unless the user wishes to modify the default settings.

Revision history for this message
Richard Virtue (rvirtue) said :
#7

The newly separate config.php file has now been included in the http://virtech.org/home/buttonmill/ download package fully self-documented as follows:

<?php
//
// Auto-detect BASEURL from the host server name - e.g., www.mydomain.com or localhost
// and assign ImageMagick executable file pathnames based on that BASEURL auto-detection.
// The ImageMagick path assignments SHOULD be modified as required for your localhost
// development and online production servers. Other config items (e.g. limits) may also
// be moved to this section if their differentiation per server is necessary or desired.
//
define('BASEURL',(!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME')));
if (BASEURL == 'localhost' || BASEURL == '127.0.0.1') {
  define('IMCONVERT',"C:\Inetapps\IMagick\convert.exe"); // full pathname for localhost development server (if any)
  define('IMMOGRIFY',"C:\Inetapps\IMagick\mogrify.exe"); // full pathname for localhost development server (if any)
} else if (BASEURL == 'something.else.com') {
  define('IMCONVERT',"/usr/local/bin/convert"); // full pathname for specified online server
  define('IMMOGRIFY',"/usr/local/bin/mogrify"); // full pathname for specified online server
} else {
  define('IMCONVERT',"/usr/bin/convert"); // full pathname for default online server
  define('IMMOGRIFY',"/usr/bin/mogrify"); // full pathname for default online server
}
//
// The following limitation and specification items may be modified according to preferences.
//
define('RECENTPERPAGE',10); // number of recent button images to be shown per page
define('MINTEMPFILEQTY',100); // trigger level for auto-deletion of files created in IMGPATH folder
define('THUMBSIZE',16); // size (in pixels) of thumbnail images for ImageMagick convert actions
define('MAXUSRIMGSIZE',100000); // maximum size (in bytes) of user image uploads
define('MAXUSRFONTSIZE',500000); // maximum size (in bytes) of user font uploads
//
// The following path items should seldom need modification unless folder/file name defaults are changed.
//
define('HOMEPAGE',"glassy.php"); // base filename of Glassy Buttons home page (change to index.php for autoloading)
define('RECENTPAGE',"recent.php"); // base filename of Glassy Buttons recent buttons page (assumes home folder)
define('READMENAME',"readme.txt"); // name of the readme text file to include in ZIP download package
define('DEFAULTZIP',"defaultglassy.zip"); // name of the default buttons ZIP file (auto-created in IMGPATH folder)
define('IMGPATH',"./temp"); // path (relative or absolute) for creating ZIPped packages of new glassy button images
define('STOCKIMGPATH',"./stockimg"); // path (relative or absolute) for publicly available button image files
define('STOCKIMGTHUMBPATH',STOCKIMGPATH."/thumbs"); // path (relative or absolute) for button image thumbs
define('USRIMGPATH',"./tempimg"); // path (relative or absolute) for user uploading of button image files
define('USRIMGTHUMBPATH',USRIMGPATH."/thumbs"); // path (relative or absolute) for uploaded of button image thumbs
define('FONTPATH',"/usr/share/fonts/truetype/ttf-dejavu"); // path (relative or absolute) for publicly available fonts
define('USRFONTPATH',"./fonts/userfonts"); // path (relative or absolute) for user uploading of TrueType fonts
define('LOGGINGPATH',"./logs"); // path (relative or absolute) for Glassy Buttons logs
//
// Items defined below are used internally and should NOT be changed unless they are fully understood.
//
// file upload
define('USERFONT',"userfont");
define('USERIMG',"userimage");
// interface text
define('BUTTON_TEXT',"button_text");
define('COLOR',"color");
define('GRCOLOR',"grcolor");

[[... etc. ...]]

?>

Revision history for this message
Eric Dennison (ericd-netdenizen) said :
#8

In the interest of snapshotting what you have and keeping a history I have downloaded the code from the virtech site and pushed it to a new branch on launchpad: lp:~ericd-netdenizen/buttonmill/virtech

Note: I do not see a config.php file in this zip file. Is everything in the zip up to date? I added only the /fonts folder and index.php to what was already there.

Revision history for this message
Richard Virtue (rvirtue) said :
#9

Hi Eric. Yes, if you downloaded after I posted my last note here, it should all be in that zip package. Did you download from the link in the note at the bottom of that http://virtech.org/home/buttonmill/ page that reads: "The source code download here has been modified under a Creative Commons license from its originator, Eric Dennison"?

All of my updates from the begininng have been (and will contine to be) put into that zip file. The direct download link is http://virtech.org/home/buttonmill/buttonmill.zip

Looking at your new branch here it appears as if it may be based on a transitional version that I had posted prior to splitting off config.php from part of the buttonincludes.php file and the restructuring the rest of the folder/files arrangment.in my own current setup.

Do you still want me to create my own branch here? Would that make it easier for you? Or would it just complicate things? I don't want to make it look like some kind of long-term divergence cuz that is not my intention at all. Is there any way that I can update your own virtech branch for you?

Revision history for this message
Richard Virtue (rvirtue) said :
#10

P.S.: You may also notice some other recent internal changes to further conform with the latest W3C standards -- closed </p>s in the help file, use of &amp; (instead of &) in the buttonincludes.php function for URI building, etc. And I've also specified some glassy.css entries a bit more closely to avoid conflicts with other CSS stylesheets that might be present on some web sites (as the unrestricted application of the <li> style did on my own for example).

Revision history for this message
Eric Dennison (ericd-netdenizen) said :
#11

I tried the direct download link again and got the same zip (I think) without any config.php. I even tried using wget in case my browser was caching the older version.

If you are willing, it would be a good idea for you to create your own branch on launchpad. Learning bazaar and the quirks of launchpad is a bit daunting, so I also understand if you don't want to. Or I can establish a group for joint control of this branch. I think launchpad will also allow you to create a branch that is hosted somewhere else, but I haven't tried that. Or I can just update this branch with your code changes from time to time.

The purpose of the branch is not to create a divergent project; I would like to merge your work into the trunk when we're ready. I just want to capture it in an alternate location in case you suddenly decide you loathe web development and everything goes away... :)

Revision history for this message
Richard Virtue (rvirtue) said :
#12

That is really WEIRD, Eric!!! I've tried using that direct download link several times from several locations to download the current buttonmill.zip file. Each time I've run a binary comparison of the downloaded buttonmill.zip package contents with the actual content on my live web production server and it has been an exact replication every time. Is it possible that your ISP uses some kind of caching proxy where an older version of the download might get "stuck" for some time? I hope to be around and playing with PHP "toys" on the web for a few years yet unless fate intervenes, but I'd really like to get this fixed up for you ASAP.

Perhaps you could try downloading http://virtech.org/home/buttonmill/buttonmill.zip again from some other convenient end point with different routing. I'll also ask my fellow users of HostGator's web hosting services to try it and let me know if they have any problem with it similar to your own. (See the HostGator discussion forum at http://forums.hostgator.com/web-design-f44.html and my postings there as "virtvir5".)

I've looked at the Launchpad/Bazaar setup and its documentation a few times now and I'm still hesitant about setting up my own branch unless there's no other way to sort out the problem. For one thing, I don't have a personal SSH key and I'm reluctant to install Putty and all that additional necessary stuff on my Windoze localhost development computer just to get one. My live CentOS/Apache production server (managed by Hostgator.com) could handle SFTP with no problem, but it uses shared a SSH key which probably isn't good enough for an externally linked Bazaar branch setup. Do you think that a GnuPG key* would be acceptable for Launchpad? I can generate one of those using my live server's cPanel.

__
*GnuPG keys: GnuPG is a publicly available encryption scheme that uses the "public key" approach. With GnuPG, messages are encrypted using a "public key" however, they can only be decrypted by a "private key", which is retained by the intended recipient of the message.

Revision history for this message
Richard Virtue (rvirtue) said :
#13

Just a brief follow-up to let you know that one of my fellow users of HG hosting tried it from his Colorado USA location and he reports the same successful download results (including config.php file verification) as I'm getting from Ontario Canada.

Revision history for this message
Eric Dennison (ericd-netdenizen) said :
#14

Thank you Richard, the problem is indeed at my end (somewhere). I logged into my web server in Montana and wget'ed the file from there. This is clearly a different file and has config.php 'n everything. I'll see if I can get the branch updated as well. Thank you for your patience!

Revision history for this message
Eric Dennison (ericd-netdenizen) said :
#15
Revision history for this message
Richard Virtue (rvirtue) said :
#16

That's g-r-r-r-e-a-t, Eric! All's well that ends well. :hooray:

Hope you find the final code updates and self-documented config.php file helful for your own future dev work and distribution.

Bye for now. Don't hesitate to contact me again if any questions arise from anything that I did with it.

Revision history for this message
Richard Virtue (rvirtue) said :
#17

Suggest one other minor coding change which I've made on my own site to avoid some occasional minor errors. Lines 325 to 330 of glassy.php can usfully be revised as follows:
if ($imagesize = get_zip_image(basename($zippath), "0", $favimgext, $pngimg, $imagename)) {
    $imgsize = getimagesize($pngimg);
    $neww = $imgsize[0];
    $newh = $imgsize[1];
    @unlink($pngimg);
}

Revision history for this message
Eric Dennison (ericd-netdenizen) said :
#18

Nice work. I've merged and removed the source change logs and revised the footer line. It's now released on the main trunk as release-20110112. And glassybuttons.com is happily running the new version without any configuration changes.

Revision history for this message
Launchpad Janitor (janitor) said :
#19

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Eric Dennison (ericd-netdenizen) said :
#20

If I had known this would expire I would have marked it answered with my last post...

Can you help with this problem?

Provide an answer of your own, or ask Richard Virtue for more information if necessary.

To post a message you must log in.