php-windows Digest 18 Jan 2005 21:47:26 -0000 Issue 2541

Topics (messages 25379 through 25386):

Re: Pre-selecting country
        25379 by: Luis Ferro

Weird windows error
        25380 by: Louis Young
        25382 by: David Elliott
        25383 by: Frank M. Kromann

Latest version of Sql Server client tools (was weird windows error)
        25381 by: Louis Young

error handling
        25384 by: phpWalter

Re: Output Image from Db to Browser
        25385 by: Wagner, Aaron
        25386 by: Randy Clamons

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 ---
Yes there is ;)

Check out the MaxMind services (the free service should be enought for that effect). [if i recall correctly, php.net uses this to try to locate the nearest mirror when downloading].

Cheers,
Luis Ferro


Zu3Bi wrote:

I'm creating a survey, and i have a list of countries in a combo box to be selected, is there way to find out from which country the client is accessing the survey so i can pre select the country without him/her having to select it...

Thx guys :)

Zu3Bi


--- End Message ---
--- Begin Message ---
Hi there

I've now upgraded both Apache and PHP.

Apache is version 2.0.52 and PHP is version 5.0.3.3. I've put the dll php_mssql.dll into C:\windows\system32 and then I do:

C:\WINDOWS\system32>regsvr32 php_mssql.dll

but I get the following error:

---------------------------
RegSvr32
---------------------------
LoadLibrary("php_mssql.dll") failed - The specified module could not be found.


---------------------------
OK ---------------------------

Any help will be greatly appreciated, thanks

Cheers
Louis

--- End Message ---
--- Begin Message ---

-- 
Hail php-windows,

Historians believe that on 18 January 2005, at 13:51:49 +0200 (which was
11:51 where I live) Louis Youngon  [email protected] wrote and made
these points

> I've now upgraded both Apache and PHP.

> Apache is version 2.0.52 and PHP is version 5.0.3.3. I've put the dll 
> php_mssql.dll into C:\windows\system32 and then I do:

C:\WINDOWS\system32>>regsvr32 php_mssql.dll

> but I get the following error:

Check your php.ini file ensure that the extensions directory is correct.

-- 
 Thank you for your time,  _______________________________________________
  David                   |    David  Elliott   |    Software Engineer    |
 _________________________| [EMAIL PROTECTED] | PGP Key ID 0x650F4534   |
| I am the cholesteral that clogs your ateries. - DarkWing Duck           |

Attachment: pgpr32Dxwqz66.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
You are not supposed to register the php_mssql.dll with windows. It's a php
dll to be used under windows, not a normal Windows dll.

All you need to have is extension=php_mssql.dll in your php.ini file (a
php.ini file that can be found by apache, either in your windows directory
or the apache2\vin directory). You also need to ntwdblib.dll on your
system. That should be in the correct place when you install the client
tools.

If you are using php5apached.dll, this file should be in the apache2\bin
folder for appache to load it correctly. You can aslo put php_mssql.dll
(and other php extensions) in this folder.

Remember to restart apache when you have made changes to php.ini.

- Frank

> Hi there
> 
> I've now upgraded both Apache and PHP.
> 
> Apache is version 2.0.52 and PHP is version 5.0.3.3. I've put the dll 
> php_mssql.dll into C:\windows\system32 and then I do:
> 
> C:\WINDOWS\system32>regsvr32 php_mssql.dll
> 
> but I get the following error:
> 
> ---------------------------
> RegSvr32
> ---------------------------
> LoadLibrary("php_mssql.dll") failed - The specified module could not be

> found.
> 
> 
> ---------------------------
> OK  
> ---------------------------
> 
> Any help will be greatly appreciated, thanks
> 
> Cheers
> Louis
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Hi

According to google the reason for me experiencing the mssql dll problem is because I don't have the latest version of MS SQL Server client tools installed.

I have MS SQL Server 2000 developer edition client tools. Does anyone know where I can find the right version or at least the right version of the ntwdblib.dll dll?

Cheers
Louis

--- End Message ---
--- Begin Message ---
What error handling routines/classes/etc do you use, and why?

Walter

--- End Message ---
--- Begin Message ---

> -----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);
?>
-------------------------------------------

--- End Message ---
--- Begin Message ---
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
> 
> 

--- End Message ---

Reply via email to