Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

more foo

  • Loading branch information...
commit e6c7814f7aead6b3c8c463f68bff036a8d8f92d7 1 parent 9c2c6ba
@mspreij authored
Showing with 608 additions and 0 deletions.
  1. +330 −0 html.inc.php
  2. +278 −0 imageplus.class.php
View
330 html.inc.php
@@ -0,0 +1,330 @@
+<?php
+
+/** -- Functions -------------------------
+ *
+ * pageStart($list)
+ * selectlist($name, $list, $selected, $usekeys = 1, $extra='', $return=false)
+ * selectListOther($name, $list, $selected, $usekeys = 1, $return=false)
+ * popup_link($link, $label, $width=300, $height=300, $options='')
+ * inputRow($name, $value, $prop_input = array())
+ * inputField($name, $value, $prop_input = array())
+ * input_datetime($name, $value, $props)
+ *
+ *
+**/
+
+
+//____________________ May need updating?
+// pageStart($list) /
+function pageStart($list) {
+ global $me;
+ $defaults = array(
+ 'stylesheet' => '',
+ 'style' => '',
+ 'javascript' => '',
+ 'jquery' => '',
+ 'js_include' => '',
+ 'headertags' => '',
+ 'body' => '',
+ 'charset' => 'UTF-8',
+ );
+ if (! is_array($list)) $list = array('title'=>$list); // if not array, assume title string
+ $list = array_merge($defaults, (array) $list); // merge default values with custom, first come first served
+ extract($list);
+ $tags = (bool) strpos(strtolower($javascript), '</script>');
+ echo "<!DOCTYPE html>
+<html>
+
+<head>
+ <title>". ($title?$title:'untitled') ."</title>
+ <meta http-equiv='content-type' content='text/html; charset=$charset'>
+ <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js' type='text/javascript'></script>\n";
+ if ($headertags) {
+ if (! is_array($headertags)) $headertags = array($headertags);
+ foreach ($headertags as $tag) {
+ if ($tag) echo "\t$tag\n";
+ }
+ }
+ if ($js_include) {
+ if (! is_array($js_include)) $js_include = array($js_include);
+ foreach($js_include as $js_incl) {
+ if ($js_incl) echo "\t<script src='$js_incl' type='text/javascript' charset='utf-8'></script>\n";
+ }
+ }
+ if ($stylesheet) {
+ if (! is_array($stylesheet)) $stylesheet = array($stylesheet);
+ foreach($stylesheet as $tmp) {
+ if ($tmp) echo "\t<link rel='stylesheet' type='text/css' href='$tmp'>\n";
+ }
+ }
+ if ($jquery) {
+ echo
+ '<script type="text/javascript">
+ $(document).ready(function(){
+ '.$jquery.'
+ });
+ </script>'."\n";
+ }
+ echo ($style?"<style type='text/css'>\n". $style ."\n</style>\n":'') ."
+". ($javascript ? ($tags ? $javascript : "<script language='javascript' type='text/javascript'>\n$javascript\n</script>\n") : '') ."
+</head>
+
+<body $body>"; // </body> -> This helps tm folding. Yeah.
+}
+
+
+//__________________________________________________________________________
+// selectlist($name, $list, $selected, $usekeys, $extra='', $return=false) /
+function selectlist($name, $list, $selected, $usekeys = 1, $extra='', $return=false) {
+ $output = "<select name='$name' $extra>\n";
+ foreach($list as $key => $value) {
+ $h_key = htmlspecialchars($key, ENT_QUOTES);
+ $h_value = htmlspecialchars($value, ENT_QUOTES);
+ if ($usekeys) {
+ $output .= "<option value='$h_key' " . (( (string) $key == (string) $selected)?'selected="selected"':'') . ">$h_value</option>\n";
+ }else{
+ $output .= "<option value='$h_value' " . (( (string) $value == (string) $selected)?'selected="selected"':'') . ">$h_value</option>\n";
+ }
+ }
+ $output .= "</select>\n";
+ if ($return) return $output;
+ echo $output;
+}
+
+
+//_____________________________________________________
+// selectlistother($name, $list, $selected, $usekeys) /
+function selectlistother($name, $list, $selected, $usekeys = 1) {
+ echo
+ "<select name='$name'
+ onchange=\"this.form.{$name}__other.style.visibility = (this.options[".count($list)."].selected)?'visible':'hidden'; return true;\">\n";
+ foreach($list as $key => $value) {
+ $h_key = htmlspecialchars($key, ENT_QUOTES);
+ $h_value = htmlspecialchars($value, ENT_QUOTES);
+ if ($usekeys) {
+ echo "<option value='$h_key' " . (( (string) $key == (string) $selected)?'selected="selected"':'') . ">$h_value</option>\n";
+ }else{
+ echo "<option value='$h_value' " . (( (string) $value == (string) $selected)?'selected="selected"':'') . ">$h_value</option>\n";
+ }
+ }
+ echo "<option value=''>Other...</option>\n";
+ echo "</select>\n";
+ echo "<input type='text' name='{$name}__other' style='margin-left: 8px; visibility: ". ($list ? 'hidden' : 'visible') .";' />\n";
+}
+
+
+#__________________________________________________________________
+# popup_link($link, $label, $width=300, $height=300, $options='') /
+function popup_link($link, $label, $width=300, $height=300, $options='') {
+ $output = '';
+ $defaults = array(
+ 'toolbar'=>'no',
+ 'location'=>'no',
+ 'directories'=>'no',
+ 'status'=>'no',
+ 'menubar'=>'no',
+ 'scrollbars'=>'yes',
+ 'resizable'=>'yes',
+ 'style'=>'',
+ 'class'=>'',
+ 'return'=>false); # that last key makes the function return the code instead of echo it
+ if (is_array($options)) {
+ $options = array_merge($defaults, $options); # have the values of options override those in defaults, but
+ $defaults = array_intersect_key($options, $defaults); # ..kick out the keys not existing in defaults.
+ }
+ extract($defaults);
+ $output = "<A HREF='#'
+ style='$style'
+ class='$class'
+ onClick=\"MyWindow=window.open('$link','MyWindow','toolbar=$toolbar,location=$location,directories=$directories,status=$status,menubar=$menubar,scrollbars=$scrollbars,resizable=$resizable,width=$width,height=$height'); return false;\">$label</A>";
+ if ((bool) $return) {
+ return $output;
+ }else{
+ echo $output;
+ }
+}
+
+
+#_______________________________________
+# inputRow($name, $value, $prop_input) /
+function inputRow($name, $value, $prop_input = array()) {
+ $sp = '&nbsp;';
+ if (! is_array($prop_input)) {
+ $prop_input = stringToAssoc($prop_input);
+ }
+ $defaults = array(
+ 'label' => ucwords($name),
+ 'type' => 'text',
+ 'size' => 32,
+ 'maxlength' => '255',
+ 'td1class' => '');
+ $props = array_merge($defaults, $prop_input);
+ extract($props);
+ if ($type == 'none') return false; # do not display
+ $label = str_replace('%20', ' ', $label);
+ if ($type != 'row') {
+ echo
+ "<TR><TD VALIGN='top' CLASS='td1 $td1class'>\n".
+ " $label$sp\n".
+ "</TD><TD VALIGN='top' CLASS='td2'>\n";
+ inputField($name, $value, $prop_input);
+ echo "</TD></TR>\n\n";
+ }else{
+ echo "<TR><TD COLSPAN='2'>\n";
+ echo $value;
+ echo "</TD></TR>\n";
+ }
+}
+
+
+#_________________________________________
+# inputField($name, $value, $prop_input) /
+function inputField($name, $value, $prop_input = array()) {
+ $output = '';
+ static $label_id = 1;
+ if (! $name) return $label_id++;
+ if (! is_array($prop_input)) {
+ $prop_input = stringToAssoc($prop_input);
+ }
+ $defaults = array(
+ 'type' => 'text',
+ 'size' => 40,
+ 'maxlength' => 255,
+ 'rows' => 4,
+ 'maxrows' => 20,
+ 'cols' => 60,
+ 'class' => '',
+ 'wrap' => 'virtual',
+ 'checked' => '',
+ 'link_params' => '',
+ 'text' => '',
+ 'extra' => '',
+ 'return' => false
+ );
+ $props = array_merge($defaults, $prop_input);
+ foreach($props as $key => $waarde) {
+ if (is_string($waarde)) $props[$key] = rawurldecode($waarde);
+ // $props[$key] = str_replace('%20', ' ', $waarde);
+ }
+ extract($props);
+ if ($type == 'none') return false; # do not display
+ if ((bool) $checked) $checked = "checked='checked'"; // 'checked'
+ if (isset($ml)) $maxlength = $ml; // 'maxlength'
+ switch (strtolower($type)) {
+ case 'text': # text
+ $output = " <input type='text' name='$name' size='$size' maxlength='$maxlength' value='".htmlents($value)."' ". @$options ." class='$class'>$extra\n";
+ break;
+ case 'textarea': # textarea
+ case 'ta': # textarea
+ if (! is_int($rows)) {
+ if (substr($rows, 0, 1) == 'n') $rows = min(substr_count($value, "\n") + (int) substr($rows, 1), $maxrows);
+ }
+ $output = " <textarea rows='$rows' cols='$cols' name='$name' wrap='$wrap' class='$class' ". @$options .">". htmlents($value) ."</textarea>\n";
+ break;
+ case 'checkbox': # checkbox
+ $output = " <LABEL FOR='l_$label_id'><INPUT TYPE='checkbox' NAME='$name' ID='l_$label_id' VALUE='".htmlents($value)."' $checked> $label</LABEL>\n";
+ $label_id++;
+ break;
+ case 'checkbool': # checkbool
+ $output = " <INPUT TYPE='hidden' VALUE='0' NAME='$name'>\n".
+ " <INPUT TYPE='checkbox' NAME='$name' VALUE='1' ". ($value?'CHECKED':'') ." $extra> $text\n";
+ break;
+ case 'radio': # radio
+ $output = " <LABEL FOR='l_$label_id'><INPUT TYPE='radio' NAME='$name' ID='l_$label_id' VALUE='".htmlents($value)."' $checked> $label</LABEL>\n";
+ $label_id++;
+ break;
+ case 'select': # select (external)
+ if (is_string($list)) {
+ $list = stringToAssoc($list);
+ foreach($list as $key => $item) {
+ $list[$key] = rawurldecode($item);
+ }
+ }
+ $output .= selectList($name, $list, $value, @$usekeys, @$extra, 1);
+ break;
+ case 'selectother': # selectother (external)
+ if (is_string($list)) {
+ $list = stringToAssoc($list);
+ foreach($list as $key => $item) {
+ $list[$key] = rawurldecode($item);
+ }
+ }
+ $output .= selectlistother($name, $list, $value, @$usekeys, 1);
+ break;
+ case 'datetime': # datetime (external)
+ $output = input_datetime($name, $value, array_merge($props, array('show_time'=>true, 'return'=>true)));
+ break;
+ case 'date': # date (external)
+ $output = input_datetime($name, $value, array_merge($props, array('show_time'=>false, 'return'=>true)));
+ break;
+ case 'password': # password
+ $output = " <INPUT TYPE='password' NAME='$name' SIZE='$size' MAXLENGTH='$maxlength' VALUE='".htmlents($value)."' class='$class'>\n";
+ break;
+ case 'file': # file
+ $output = " <INPUT TYPE='file' NAME='$name'>\n";
+ break;
+ case 'image': # image (calls file)
+ if (! isset($preview)) $preview = $value;
+ if ($preview) $output = "<a href='".str_replace('%2F', '/', urlencode($path)).urlencode($value)."' target='_blank'><img src='".str_replace('%2F', '/', urlencode($path)).urlencode($preview)."'></a><br>";
+ $output .= inputField($name, $value, 'type=file return=1');
+ break;
+ case 'hidden': # hidden
+ $output = " <INPUT TYPE='hidden' NAME='$name' VALUE='".htmlents($value)."'>\n";
+ break;
+ case 'display': # display
+ $output = $value."\n";
+ break;
+ default:
+ $output = styledText("inputField() error: Unsupported type: $type<BR>", 'red');
+ break;
+ }
+ if ($return) return $output;
+ echo $output;
+}
+
+
+#________________________________
+# input_datetime($name, $props) /
+function input_datetime($name, $value, $props) {
+ $output = '';
+ $defaults = array(
+ 'show_time' => true,
+ 'year_list' => range(date('Y')-7, date('Y')+4),
+ 'month_list' => get_month_list(),
+ 'return' => false);
+ $props = array_merge($defaults, $props);
+ extract($props);
+ if (! $value) $value = date('Y-m-d H:i');
+ list($year, $month, $day, $time) = sscanf($value, "%d-%d-%d %s"); // regular MySQL datetime format
+ $output .= inputField($name .'_d', $day, array('type'=>'select', 'list'=>range(1, 31), 'usekeys'=>false, 'return'=>true));
+ $output .= inputField($name .'_m', $month, array('type'=>'select', 'list'=>$month_list, 'usekeys'=>true, 'return'=>true));
+ $output .= inputField($name .'_y', $year, array('type'=>'select', 'list'=>$year_list, 'usekeys'=>false, 'return'=>true));
+ if ($show_time) {
+ $output .= ', ' . inputField($name .'_t', substr($time, 0, 5), 'type=text size=10 maxlength=8 return=1');
+ }
+ if ($return) return $output;
+ echo $output;
+}
+
+if (basename($_SERVER['PHP_SELF']) == 'html.inc.php') echo "'html.inc.php' parses.";
+
+
+/* -- Log --------------------------------
+
+[2010-10-27 13:35:14] Ditto.
+[2010-03-24 03:00:31] Copied from somewhere recent enough
+[2009-09-13 05:46:57] Updated selectList, selectlistother, input_datetime & inputField, added parameter $return and variable $output
+[2009-08-15 00:00:48] Fixed pageStart to only show jQuery document.ready tags if there's actual jQuery content passed.
+[2009-04-12 04:26:58] Threw script.js out again. Use jQuery damnit.
+[2009-04-12 02:02:53] Added script.js to default pageStart()
+ Copied @$options from inputField "input" to "textarea" since it's a useful beastie.
+[2009-02-06 06:27:03] Copied from Saturn
+[2008-11-15 18:55:50] input_datetime was only accepting two params, value missing, fixed.
+ also, it called inputField with only two params (also fixed). what's with this thing?
+[2008-10-11 16:54:38] Copied file from Mech.CX
+
+Todo: patch selectListOther to not rely on it being inside a form (does getElementsByName('foo')[0] work?)
+
+*/
+
+?>
View
278 imageplus.class.php
@@ -0,0 +1,278 @@
+<?php
+
+/*
+ This EXTENDS image.class.php
+*/
+
+require_once 'image.class.php';
+
+class ImagePlus extends Image {
+
+ /** -- Methods -------------------------
+ *
+ * __construct($x, $y=null) -- $x/$y are width/height, or $x is width&height, or $x is image filename
+ * fill($color)
+ * tttext($text, $x, $y, $color=0, $size=12, $angle=0)
+ * textbox($size=12, $angle=0, $text) -- ehr.. similar to ttsize, I guess.. merge someday
+ * ttsize ($text, $size=12, $full=0)
+ * text($string, $x, $y, $color=0, $size=2)
+ * setcolor($name, $value)
+ * draw_border($color=0)
+ * rect($x, $y, $x2, $y2, $color=0, $filled=0)
+ * rect2($coords, $color=0, $filled=0)
+ * circle($x, $y, $width, $height, $color=0, $filled=0)
+ * poly($coords, $color=0, $fill=0) -- coords array has two items per point (x0, y0, x1, y1, ...)
+ * line($x, $y, $x2, $y2, $color=0)
+ * point($x, $y, $color=0)
+ * select($x, $y, $x2, $y2) -- select an area on which the image operations that follow should operate
+ * deselect([$x, $y, $x2, $y2]) -- deselect everything, or subtract from the current selection
+ * intify(&$color) -- stomps input into color integer
+ * draw()
+ * __call($name, $args) -- allows to call php image functions, skip the image resource though (first arg), the class adds that
+ * __destruct()
+ *
+ *
+ **/
+
+
+ var $img; # image resource
+ var $x = 100;
+ var $y = 100;
+ var $bgcolor = 0xFFFFFF;
+ var $antialias = true;
+ var $fontfile = 'fonts/arialblack.ttf';
+ var $selected = false; // active selection flag
+ var $copy;
+ var $color_list = array(
+ 'black' => 0x000000,
+ 'silver' => 0xC0C0C0,
+ 'gray' => 0x808080,
+ 'white' => 0xFFFFFF,
+ 'maroon' => 0x800000,
+ 'red' => 0xFF0000,
+ 'purple' => 0x800080,
+ 'fuchsia' => 0xFF00FF,
+ 'green' => 0x008000,
+ 'lime' => 0x00FF00,
+ 'olive' => 0x808000,
+ 'yellow' => 0xFFFF00,
+ 'navy' => 0x000080,
+ 'blue' => 0x0000FF,
+ 'teal' => 0x008080,
+ 'aqua' => 0x00FFFF);
+
+ //______________________
+ // __construct($x, $y) /
+ function __construct($x, $y=null) {
+ if ($y or is_int($x)) {
+ if (! $y) $y = $x;
+ $this->x = $x;
+ $this->y = $y;
+ $this->img = imagecreatetruecolor($this->x, $this->y); # create image
+ imagefill($this->img, 0, 0, $this->bgcolor); # fill in
+ }else{
+ if (is_string($x)) {
+ parent::Image($x);
+ $this->x = imagesx($this->img);
+ $this->y = imagesy($this->img);
+ }
+ }
+ if (function_exists('imageantialias')) imageantialias($this->img, $this->antialias); # anti-alias
+ imagealphablending($this->img, true); # support alpha channels
+ }
+
+ // -- fill($color)
+ function fill($color, $coords = array(0,0)) {
+ if (! is_numeric($color)) $color = $this->intify($color);
+ $this->bgcolor = (int) $color;
+ if (! is_array($coords)) $coords = array((int) $coords, (int) $coords);
+ list ($x, $y) = $coords;
+ imagefill($this->img, $x, $y, $this->bgcolor);
+ }
+
+ // -- tttext($text, $x, $y, $color=0, $size=12, $angle=0)
+ function tttext($text, $x, $y, $color=0, $size=12, $angle=0) {
+ if (! is_numeric($color)) $color = $this->intify($color);
+ imagettftext($this->img, (float) $size, $angle, (int) $x, (int) $y, $color, $this->fontfile, $text);
+ }
+
+ // -- textbox($size=12, $angle=0, $text) Todo: merge this with ttsize() below
+ function textbox($size=12, $angle=0, $text) {
+ return imageftbbox($size, $angle, $this->fontfile, $text);
+ }
+
+ // -- ttsize ($text, $size=12, $full=0)
+ function ttsize ($text, $size=12, $full=0) {
+ $res = imagettfbbox((float) $size, 0, $this->fontfile, $text);
+ if ($full) return $res;
+ return array($res[2]-$res[0], $res[1]-$res[7]);
+ }
+
+ // -- text($string, $x, $y, $color=0, $size=2)
+ function text($string, $x, $y, $color=0, $size=2) {
+ if (! is_numeric($color)) $color = $this->intify($color);
+ imagestring($this->img, (int) $size, $x, $y, $string, $color);
+ }
+
+ // -- setcolor($name, $value)
+ function setcolor($name, $value) {
+ $this->color_list[$name] = (int) $value;
+ }
+
+ // -- draw_border($color=0)
+ function draw_border($color=0) {
+ if (! is_numeric($color)) $color = $this->intify($color);
+ list($x, $y) = $this->getxy();
+ imagerectangle($this->img, 0, 0, $x-1, $y-1, $color);
+ }
+
+ // -- rect($x, $y, $x2, $y2, $color=0, $filled=0)
+ function rect($x, $y, $x2, $y2, $color=0, $filled=0) {
+ if (! is_numeric($color)) $color = $this->intify($color);
+ if ($filled) {
+ return imagefilledrectangle($this->img, $x, $y, $x2, $y2, $color);
+ }else{
+ return imagerectangle($this->img, $x, $y, $x2, $y2, $color);
+ }
+ }
+
+ // -- rect2($coords, $color=0, $filled=0)
+ function rect2($coords, $color=0, $filled=0) {
+ list($x, $y, $x2, $y2) = split('[,\s]+', $coords);
+ return $this->rect($x, $y, $x2, $y2, $color, $filled);
+ }
+
+ // -- circle($x, $y, $width, $height, $color=0, $filled=0)
+ function circle($x, $y, $width, $height, $color=0, $filled=0) {
+ if (! is_numeric($color)) $color = $this->intify($color);
+ if ($filled) {
+ return imagefilledellipse($this->img, $x, $y, $width, $height, $color);
+ }else{
+ return imageellipse($this->img, $x, $y, $width, $height, $color);
+ }
+ }
+
+ // -- poly($coords, $color=0, $fill=0)
+ function poly($coords, $color=0, $fill=0) {
+ $this->intify($color); // <@_Lasar> And slackify the shit out of the day.
+ if ($fill) {
+ return imagefilledpolygon($this->img, $coords, count($coords)/2, $color);
+ }else{
+ return imagepolygon($this->img, $coords, count($coords)/2, $color);
+ }
+ }
+
+ // -- line($x, $y, $x2, $y2, $color=0)
+ function line($x, $y, $x2, $y2, $color=0) {
+ if (! is_numeric($color)) $color = $this->intify($color);
+ return imageline($this->img, $x, $y, $x2, $y2, $color);
+ }
+
+ // -- point($x, $y, $color=0)
+ function point($x, $y, $color=0) {
+ if (! is_numeric($color)) $color = $this->intify($color);
+ imagesetpixel($this->img, $x, $y, $color);
+ }
+
+ // -- select($x, $y, $x2, $y2)
+ function select($x, $y, $x2, $y2) {
+ if (! $this->selected) { // first selection. create new image resource, copy current image to it, set transparent color
+ $this->copy = new ImagePlus($this->x, $this->y); // nested image objects, fun fun (but it allows reusing our methods on the copy)
+ imagecopymerge($this->copy->img, $this->img, 0, 0, 0, 0, $this->x, $this->y, 100);
+ $this->copy->trans = imagecolorallocatealpha($this->copy->img, 0, 0, 0, 127); // yep, it's see-through black
+ imagealphablending($this->copy->img, false); // (with alphablending on, drawing transparent areas won't really do much..)
+ imagecolortransparent($this->copy->img, $this->copy->trans); // somehow this doesn't seem to affect actual black areas that were already in the image (phew!)
+ $this->selected = true;
+ }
+ $this->copy->rect($x, $y, $x2, $y2, $this->copy->trans, 1); // Finally erase the defined area from the copy
+ }
+
+ // -- deselect()
+ function deselect() {
+ if (! $this->selected) return false;
+ if (func_num_args() == 4) { // deselect an area from the current selection
+ list($x, $y, $x2, $y2) = func_get_args();
+ imagecopymerge($this->copy->img, $this->img, $x, $y, $x, $y, $x2-$x, $y2-$y, 100);
+ }else{ // deselect everything, draw the perforated copy back over the original
+ imagealphablending($this->img, true);
+ imagecopymerge($this->img, $this->copy->img, 0, 0, 0, 0, $this->x, $this->y, 100); // copy the copy back
+ $this->copy->__destruct();
+ $this->selected = false;
+ }
+ }
+
+ // -- intify(&$color)
+ function intify(&$color) {
+ if (is_numeric($color)) return;
+ if (in_array($color, array_keys($this->color_list))) {
+ $color = $this->color_list[$color];
+ }else{
+ $color = 0;
+ }
+ return $color;
+ }
+
+ // draw()
+ function draw() {
+ if ($this->selected) {
+ $this->deselect();
+ }
+ header('Content-type: image/png');
+ imagepng($this->img); # (whaddayamean "image formats" ?)
+ $this->__destruct();
+ }
+
+ //_______________________ This kicks ass.
+ // __call($name, $args) /
+ function __call($name, $args) {
+ array_unshift($args, $this->img);
+ return call_user_func_array($name, $args);
+ }
+
+ //_______________ This kicks the image's ass.
+ // __destruct() /
+ function __destruct() {
+ @imagedestroy($this->img);
+ }
+
+}
+
+/* -- Log --------------------------------
+
+[2011-04-15 23:16:08] Patched intify() to make it have a RETURN VALUE (these are useful).
+[2011-04-15 22:48:16] Renamed class, removed color2int.
+[2009-10-04 23:36:42] Added textbox($size=12, $angle=0, $text) then found ttsize($text, $size=12, $full=0) already existed, must merge someday..
+[2009-06-29 04:12:41] __call() *returns* value (this could be useful, yanno?)
+[2009-06-28 02:17:50] done adding select() & deselect().
+[2009-05-07 00:57:12] now EXTENDS image.class.php for easy reading and saving files.
+[2009-05-06 15:59:16] draw() now calls $this->__destruct(); instead of imagedestroy(), I think this is allowed (and maybe more betterer)
+[2009-05-06 15:34:42] added circle
+[2008-12-17 11:42:36] experimenting with $coords vs "$x, $y, $x2, $y2, .." [*1]
+[2008-12-17 11:38:42] set alpha blending is true by default
+
+Todo: add function head comments, update f list, etc
+Todo: add some helper methods to deal with alpha stuff ("60% red")
+Todo: some of these methods are getting too many optional arguments.. pass assoc array with defaults ('foo'=>$this->foo, or 'foo'=>$this->settings['foo']) in the function body?
+Todo: select/deselect is nice. Next up: layers?
+Todo: draw($format) for gif, jpg etc?
+Todo: Catch errors, print them as text in the image. If no image can be created, create one anyway large enough to hold the error text. If the error-image can't be
+ created, cry and stamp your feet.
+
+------------------------------------------
+
+Done: fase out color2int, replaced by intify()
+
+Idea: make $fill[ed] a float, for alpha?
+
+New image:
+200, 300 -> $x, $y
+1000 -> $x, $y => 1000, 1000
+image.png -> read in file
+200+chars,LikelyBinaryCode -> interpret as image data
+
+1: func_get_args() could be useful here but will need type checking or somesuch if there are more optional arguments added (since it's hard
+to distinguish between 4 coordinates and 1 $coords + 3 optional args). use assoc arrays for optional argument passing?
+
+*/
+
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.