Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

phpaintings: painting number 1: Microsoft stock quotes

0 views
Skip to first unread message

Lemmy Caution

unread,
Aug 1, 2004, 1:18:41 PM8/1/04
to WRYT...@listserv.utoronto.ca
 
Yes, it looks MUCH like the previous experiment I did with dynamically generated images(it should, seeing as how it's built on the previous experiment's code); this one, however, relies on external data to decide how many (randomly-placed)solid lines, dashed lines, and randomly-colored pixels to use. The external data is generated from Yahoo stock quotes for Microsoft stock...
 
SOURCE CODE HERE:
written in PHP, using the GD Library
__________________________________________________
/*
phpainting #1
by Lewis LaCook
August 2004
==generates psudo-random dynamic PNG, with lines and pixels determined by Microsoft stock
*/
Class yahoo
    {
    function get_stock_quote($symbol)
    {
    $url = sprintf("http://finance.yahoo.com/d/quotes.csv?s=%s&f=sl1d1t1c1ohgv" ,$symbol);
    $fp = fopen($url, "r");
    if(!fp)
    {
    echo "error : cannot recieve stock quote information";
    }
    else
    {
    $array = fgetcsv($fp , 4096 , ', ');
    fclose($fp);
    $this->symbol = $array[0];
    $this->last = $array[1];
    $this->date = $array[2];
    $this->time = $array[3];
    $this->change = $array[4];
    $this->open = $array[5];
    $this->high = $array[6];
    $this->low = $array[7];
    $this->volume = $array[8];
    }
    }
    }
    $quote = new yahoo;
    $quote->get_stock_quote("MSFT");
srand((double) microtime()*1000000);
//set up image
$height=640;
$width=480;
$rgbRange0=rand(0, 255);
$rgbRange1=rand(0, 255);
$rgbRange2=rand(0, 255);
$rgbRange3=rand(0, 255);
$rgbRange4=rand(0, 255);
$rgbRange5=rand(0, 255);
$rgbRange6=rand(0, 255);
$rgbRange7=rand(0, 255);
$rgbRange8=rand(0, 255);
$rgbRange=rand(0, 255);

$im=ImageCreate($width, $height);
$color[0]=ImageColorAllocate($im, $rgbRange0, $rgbRange5,$rgbRange8);
$color[1]=ImageColorAllocate($im, $rgbRange4, $rgbRange3, $rgbRange5);
$color[3]=ImageColorAllocate($im, $rgbRange8, $rgbRange2,$rgbRange1);
$color[4]=ImageColorAllocate($im, $rgbRange0, $rgbRange8, $rgbRange7);
$color[5]=ImageColorAllocate($im, $rgbRange5, $rgbRange8,$rgbRange6);
$color[6]=ImageColorAllocate($im, $rgbRange9, $rgbRange8, $rgbRange5);
$color[7]=ImageColorAllocate($im, $rgbRange5, $rgbRange1,$rgbRange8);
$color[8]=ImageColorAllocate($im, $rgbRange6, $rgbRange6, $rgbRange7);
//draw on image
//canvas
ImageFill($im, 0, 0, array_rand($color));

//pixels
for($i=0; $i <= $quote->last; $i++){
imagesetpixel($im, rand(0, 480), rand(0,640), array_rand($color));
}
//lines
//dashed
for($x=0; $x <= $quote->high; $x++){
imagedashedline($im,rand(0, 480), rand(0,640),rand(0, 480), rand(0,640),array_rand($color));
}
//filled
for($x=0; $x <= $quote->low; $x++){
imageline($im,rand(0, 480), rand(0,640),rand(0, 480), rand(0,640),array_rand($color));
}
//output image
Header("Content-type: image/png");
ImagePng($im);
//clean up
ImageDestroy($im);
 
_______________________________________________________
 
 
 
 
 


***************************************************************************

Lewis LaCook

net artist, poet, freelance web developer/programmer

http://www.lewislacook.com/

XanaxPop:Mobile Poem Blog>> http://www.lewislacook.com/xanaxpop/

Stamen Pistol: http://stamenpistol.blogspot.com/

Cell:440.258.9232

Sidereality: http://www.sidereality.com/

 

 

 


Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

Alan Sondheim

unread,
Aug 1, 2004, 1:35:14 PM8/1/04
to WRYT...@listserv.utoronto.ca
This is great - I wonder if you couldn't extend it to an actual aesthetics
of painting, i.e. other shapes, line thickness, etc., the kinds of things
you find in vb? A whole art could be built around this! - Alan

recent http://www.asondheim.org/
http://www.asondheim.org/portal/.nikuko
WVU recent http://www.as.wvu.edu:8000/clc/Members/sondheim
WVU 2004 projects http://www.as.wvu.edu/clcold/sondheim/files/
Trace projects http://trace.ntu.ac.uk/writers/sondheim/index.htm
partial mirror at http://www.anu.edu.au/english/internet_txt

Johan Meskens CS3 jmcs3

unread,
Aug 1, 2004, 2:15:23 PM8/1/04
to WRYT...@listserv.utoronto.ca
" the amazing thing about the phpaintings are the bugs

the *9 one has been there ever since .. 0

the '$'fp one ..

, i don't understand who you get it to work with them ?

tail /var/log/httpd/error_log

errata linguarum

On 01 Aug 2004, at 19:17, Lemmy Caution wrote:

..

>     if(!fp)

..

> $rgbRange=rand(0, 255);

..

> $color[6]=ImageColorAllocate($im, $rgbRange9, $rgbRange8, =
$rgbRange5);

..=

Johan Meskens CS3 jmcs3

unread,
Aug 1, 2004, 2:21:25 PM8/1/04
to WRYT...@listserv.utoronto.ca
, my language fails me

the register of the rand
een andere zijde
zeide

he and she ++

undra, tra IN

On 01 Aug 2004, at 20:19, Johan Meskens CS3 jmcs3 wrote:

> " s
>
>
>
>
>
>
>
>
>
> ****** **********

Johan Meskens CS3 jmcs3

unread,
Aug 1, 2004, 2:24:18 PM8/1/04
to WRYT...@listserv.utoronto.ca
, undefinition actually

CONSTANT & $VARIABLE

.

.

.

.

>>> $rgbRange5);
>>
>> ..
>>
>
>

Johan Meskens CS3 jmcs3

unread,
Aug 1, 2004, 2:26:57 PM8/1/04
to WRYT...@listserv.utoronto.ca
, having 1 draft of a babylonian tunnel


several bricks
$++
within an application
..

Deere Warener Nard,

unread,
Aug 1, 2004, 2:27:25 PM8/1/04
to WRYT...@listserv.utoronto.ca
Or is it a wry question about delimited semantics?
What is a painting? What is paint; when the very 'substance'
of 'art' has become an abstraction (and abstraction a form
or specie code?).. By connecting chromatic
variation to the manifold of informatics by linguistically privileging
the culturally recognizable limits of a 'frame' within a narrowly
functioning aleatorics, the piece seems to point to both
art's limited role in society as well as the individual's limited
understanding of the process behind any 'object', but that very
limitation is coextensive with its possibility, ie infinite limitation=
infinite possibility which says to me 'extremely human'
ie paradoxical to say the least..

yammeryammer
yam
lq

Johan Meskens CS3 jmcs3

unread,
Aug 1, 2004, 2:30:57 PM8/1/04
to WRYT...@listserv.utoronto.ca
..

Johan Meskens CS3 jmcs3

unread,
Aug 1, 2004, 2:33:28 PM8/1/04
to WRYT...@listserv.utoronto.ca
, closing several bricks in sentD
the building--
fromto
returning to zero
a perfect circle, otherly formed
einde + danku
0 new messages