php-windows Digest 19 Jan 2005 12:55:47 -0000 Issue 2542

Topics (messages 25387 through 25390):

Installing Pear on Win XP
        25387 by: Raymond Still
        25389 by: Jason Barnett

Re: Output Image from Db to Browser
        25388 by: MikeA

DBA functions
        25390 by: Patrick Roane

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Please forgive the somewhat off topic post, but this
just seemed like the best place to start.
I'm trying to install PEAR on my Win XP box. I'm
running Apache and PHP 5. It seems like the best place
to put PEAR is in the Apache htdocs folder. I installed
Apache under the "Program Files" folder. (note the
space). go-pear.php chokes on the space, but if I put
PEAR somewhere else, I can't find the PEAR tools with
my browser. Do I have any choices besides: 1) move
Apache :(   or 2) ditch M.S. and completly start over
(I just wish).
If anybody can direct me to a better place to ask this
question, that would also be much appreciated.

Thanks
Ray 

--- End Message ---
--- Begin Message --- Raymond Still wrote:
Please forgive the somewhat off topic post, but this
just seemed like the best place to start.

This is a fine place to ask, but for future PEAR questions you might also try the php-pear-general group.


I'm trying to install PEAR on my Win XP box. I'm
running Apache and PHP 5. It seems like the best place
to put PEAR is in the Apache htdocs folder. I installed
Apache under the "Program Files" folder. (note the
space). go-pear.php chokes on the space, but if I put

Here's the thing. PHP scripts (i.e. PEAR) don't *have* to be under the document root. In fact it's probably better to not do that anyways. I have my own PEAR installation under C:\PHP\PEAR. Just make sure that the path to PEAR is in your php.ini (it needs to be added to your include_path) and all PEAR scripts should run fine.


If memory serves I just used the go-pear.bat and use all of the default choices. In fact I re-installed everything just now and it installed perfectly. In fact it will even change your include_path, if you want it to do this for you.

Another tip: after PEAR is install from the command prompt you can type

cd\PHP
pear --help



--
Teach a person to fish...

Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://www.php.net/manual/en/index.php
php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2

--- End Message ---
--- Begin Message ---
I've tried both ways. I call the function from within the <IMG SRC=....."> and 
I have tried to echo 
it outside of that.

Which is the best way and/or the proper way?  I still cannot get it to work but 
I have one more 
thing to try that a gentleman just sent.

Any ideas are certainly welcome!

Mike

"Randy Clamons" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Mike,

I'm wondering, are you trying to send the image inline with the rest of the 
page, or is it response 
to an img tag?

 Randy Clamons
Systems Programming
Astro-auction.com


> ------------Original Message------------
> From: "Wagner, Aaron" <[EMAIL PROTECTED]>
> To: "MikeA" <[EMAIL PROTECTED]>, [email protected]
> Date: Tue, Jan-18-2005 12:53 PM
> Subject: RE: [PHP-WIN] Output Image from Db to Browser
>
>
>
> > -----Original Message-----
> > From: news [mailto:[EMAIL PROTECTED] Behalf Of MikeA
> > Sent: January 17, 2005 17:31
> > To: [email protected]
> > Subject: [PHP-WIN] Output Image from Db to Browser
> >
> >
> > I am trying to output a JPG image to the browser without
> > creating a file. I have tried several
> > things but nothing seems to work. I sure could use a whole
> > lot of help right now!  LOL  Going crazy
> > trying to figure this out.  But I know there are PHP gurus
> > out there that will have the answer in 2
> > seconds.  Hopefully I'll be at that level someday too!
> >
> > The image comes from a MySQL Blob.  The closest I get is a
> > string of garbage on the browser display.
> > I cannot get it to display a pictures.
> >
> > Suggestions, comments, help, almost anything is appreciated.
> > PLEASE help me! Project due in a week.
> >
> > Thanks in advance.
> >
> > Mike
> >
> >
> >     if( mysql_num_rows($result) == 1 )
> >   {
> >     //header('Content-type: image/*');
> >     $fileContent = mysql_result($result,0);  //,$blobfield);
> >      echo $fileContent;
> >
> >     //$theimage = imagecreatefromstring ($fileContent);
> >
> >     //echo imagejpeg ( $theimage);
> >
> > -- 
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> Here is how I'm doing it in a Call Flow setting.
>
> ---------------------------------
> <?php
> // -- program to dynamically create call flows from DB calls.
> // -- The jpeg created here has to be within it's own frame\window with
> it's own header.
> // -- maybe a iframe.
>
> //variables passed into script
> //$txt = 'sometext'
> //$shapetype = 'eclipse'
> //$shapetype = 'polygon'
> //$shapetype = 'rectangle'
>
> if ($txt == ''){
> $txt =  "A Simple Text string \n A Simple Text string \n A Simple
> string A Simple Text string A Simple Text string A Simple Text string A
> Simple Text string A Simple Text string A Simple Text string A Simple Text
> string ";
> }else if (substr($txt, 0,6) == '<html>'){
> print stripslashes($txt);
> die();
> }
>
> switch($shapetype){
> case'eclipse':
> $xshape_buffer = 25;
> $yshape_buffer = 25;
> break;
> case'rectangle':
> $xshape_buffer = 30;
> $yshape_buffer = 50;
> break;
> case'polygon':
> $xshape_buffer = 25;
> $yshape_buffer = 25;
> break;
> }
> // declare variables
> $fontType = 5;
> $fontPixelWidth = imagefontwidth($fontType);
> $fontPixelHeight = imagefontheight($fontType);
> $line_width = 50;
> $txt_len = strlen($txt);
> //------------------------
>
> $arr_txtStart = preg_split("/\s\b/", $txt, -1, PREG_SPLIT_NO_EMPTY);
> $num_lines = count($arr_txt);
>
> $s = '';
> $arr_txt=array();
> $i=0;
> foreach($arr_txtStart as $word){
> $len_s = strlen($s);
> $len_word = strlen($word) + 1; //add 1 for spaceadded
> if(preg_match("/\r/i", $word )){
> // print "1-$i-$word1<br>";
> $s = $s." ".$word;
> $arr_txt[$i] = trim($s);
> $s = '';
> $i++;
> }else if (($len_s + $len_word)<$line_width){
> // print "2-$i-$word<br>";
> $s = $s." ".$word;
> }else{
> // print "3-$i-$word<br>";
> $arr_txt[$i] = trim($s);
> $s = $word;
> $i++;
> }
> }
> $arr_txt[$i] = $s;  //add the remaining text to the array
> $num_lines = count($arr_txt);
> // create a shape width set to $line_width plus ?? pixels as a buffer
> $xsize = ($fontPixelWidth * $line_width) + $xshape_buffer;
> $ysize = (($fontPixelHeight) * $num_lines) + $yshape_buffer;
>
> //print "x- $xsize y- $ysize";
> //die();
> if ($xsize < 475){
> $xsize = 475;
> }
> if ($ysize < 170){
> $ysize = 170;
> }
>
>
> //array_push($arr_txt, "x_size $xsize | y_size $ysize | str
> len".strlen($txt) );
> //------------------------------------
>
> $im = imagecreate ($xsize, $ysize) or die ("Cannot Initialize new GD
> image stream");
> //$im = imagecreate(450, 150) or die ("Cannot Initialize new GD image
> stream");
>
> //header ("Content-type: image/jpeg");
> //$background_color = imagecolorallocate ($im, 229,255,150);  //yellow
> //$background_color = imagecolorallocate ($im, 255,255,255); //white
> $background_color = imagecolorallocate ($im, 0,0,0); //black
> $poly_color = imagecolorallocate ($im, 0, 150, 100); //green
> $text_color = imagecolorallocate ($im, 255,255,255); //white
>
> //declare point values for the polygon
> $p[0] = $xsize/2;
> $p[1] = 0;
> $p[2] = $xsize;
> $p[3] = $ysize/2;
> $p[4] = $xsize/2;
> $p[5] = $ysize;
> $p[6] = 0;
> $p[7] = $ysize/2;
>
> if ($shapetype == "polygon"){
> imagefilledpolygon($im, $p, 4, $poly_color);
> }else if($shapetype == "rectangle"){
> imagefilledrectangle ($im, 5, 5, ($xsize-5), ($ysize-5), $poly_color);
> }else if($shapetype == "eclipse"){
> $poly_color = imagecolorallocate ($im, 246, 133, 137); //pink
> imagefilledellipse ($im, ($xsize/2), ($ysize/2), ($xsize), ($ysize),
> $poly_color);
> }else{
> die("No Flow ID Selected");
> }
> // --------------------------- string formatting
> -------------------------------------
> //find the rough middle of the string
>
> if (strlen($txt) <= $line_width){
> $middle = (($xsize/2) - ($fontPixelWidth * (strlen($txt)/2)));
> }else {
> $middle = ($xsize/2) - ($fontPixelWidth * ($line_width/2));
> }
>
> if ($shapetype == "polygon"){
> //$poly_color = imagecolorallocate ($im, 255, 255, 255);
> //$text_color = imagecolorallocate ($im, 0,0,0);
> imagecolortransparent($im, $text_color);
> imagerectangle ($im, 0, 0, ($xsize), ($ysize), $poly_color);
> $nl=(($ysize/2)-(($num_lines/2)*$fontPixelHeight));
> }elseif ($shapetype == "eclipse"){
> if ($txt_len > 1000){
> $poly_color = imagecolorallocate ($im, 255, 255, 255);
> $text_color = imagecolorallocate ($im, 0,0,0);
> imagecolortransparent($im, $text_color);
> imagerectangle ($im, 0, 0, ($xsize), ($ysize), $poly_color);
> }
> $nl=(($ysize/2)-(($num_lines/2)*$fontPixelHeight));
> array_push($arr_txt, "");
> array_push($arr_txt, "");
> $sp = ($xsize/2) - ($fontPixelWidth * 5);
> $newsp = ($sp - $middle)/$fontPixelWidth;
> for ($r=1;$r < $newsp;$r++){
> $spacer .= ' ';
> }
> //print "$sp | $newsp | $middle |$spacer|";
> array_push($arr_txt, "$spacer End of Flow");
> }elseif ($shapetype == "rectangle"){
> $nl=(($ysize/2)-(($num_lines/2)*$fontPixelHeight));
> }
>
> for ($i=0;$i < (count($arr_txt));$i++){
> imagestring ($im, $fontType, ($middle), ($nl),
> trim(stripslashes($arr_txt[$i])), $text_color);
> $nl += 12;
> }
> //sequence number in top left corner of flow
> imagestring ($im, 0, (5), (5), $seqnum, $text_color);
> //$seqnum
> //$tmpfilename = 'temp'.(md5(uniqid("", TRUE))).'.jpg';
> //print $tmpfilename;
> //die();
>
> header ("Content-type: image/jpeg");
> ImageJPEG($im, "", 70);
> imagedestroy($im);
> ?>
> -------------------------------------------
>
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
I need to use DBM-style abstraction layer functions 
see: http://www.php.net/manual/en/ref.dba.php


I am trying to find out if I compiled php (I actually
installed WAMP 5:
----------------------------------
Apache version :         Apache/1.3.33 (Win32)
PHP version :   5.0.3
MySQL version :         4.1.8-nt-log - extension : mysqlite
-----------------------------------
with support for any of the DBA handlers listed in
table found here: 

http://www.php.net/manual/en/ref.dba.php

Does anyone know how I can find out? I tried to use
the function:
---------------------------------
var_dump( dba_handlers() );
---------------------------------
which is supposed to give me a quick listing of
available handlers. But when I run this, I get: 
-----------------------------------
Fatal error: Call to undefined function dba_handlers()
in c:\wamp\www\dba_function.php on line 10
----------------------------------
thanks-


=====

----------------
"forget your lust for the rich man's gold. All that you need, is in your soul. 
You can do this if you try. All that I want for you my son, is to be satisfied"

  ~ Lynard Skynard

--- End Message ---

Reply via email to