php-windows Digest 28 Dec 2003 01:06:37 -0000 Issue 2059

Topics (messages 22431 through 22433):

Re: imagecopyresampled question
        22431 by: Bobo Wieland

Re: IIS metabase control, COM/DCOM problems
        22432 by: Frank M. Kromann
        22433 by: Andrew Séguin

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 ---
Thanks for your replay.
The C-programing article was interesting. However; my problem was much simpler then I 
first thought. Here is the code I've written:

<code>

//$imgurl is the uploaded file
//$name is the new name for the image
//$cor_x is the x coordinate in the original image where the thumb should start
//$cor_y is the y coordinate...
//$orig_w is the original width of the area that should be converted to the thumb.
//$orig_h is the original height...

function jpgUploadSmall($imgurl, $name, $cor_x, $cor_y, $orig_w, $orig_h) {
    $thmb_w = 50;
    $thmb_h = 50;
    $path="../../plantis/img/sort/";
    $fileName = $name.".jpg";
 
    $origImg = imagecreatefromjpeg($imgurl["tmp_name"]) or die("Could not create 
image");
    $tmpImgA = imagecreatetruecolor($orig_w, $orig_h);
    $tmpImgB=imagecreatetruecolor($thmb_w,$thmb_h);
 
    imagecopy($tmpImgA, $origImg, 0, 0, $cor_x, $cor_y, $orig_w, $orig_h);
    imagecopyresampled($tmpImgB,$tmpImgA,0,0,0,0,$thmb_w,$thmb_h, $orig_w, $orig_h);
    imagejpeg($tmpImgB,$path.$fileName) or die("Could not write image");
 
    imagedestroy($origImg);
    imagedestroy($tmpImgA);
    imagedestroy($tmpImgB);
 
    return $fileName;
}
</code>

----- Original Message ----- 
From: "Svensson, B.A.T. (HKG)" <[EMAIL PROTECTED]>
To: "'Bobo Wieland '" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, December 27, 2003 11:43 AM
Subject: RE: [PHP-WIN] imagecopyresampled question


> If I understand your problem correctly, you want to make
> a thumbnail out of a subpart of a picture? Is this correct? 
> 
> In the case you just want to create a thumbnail of a picture
> you might like to have a look at these functions:
> 
>  * exif_thumbnail()
>  * getimagesize();
> 
> If you want to create a thumbnail out of a subpart, then I am
> (in my\ very limited knowledge) not aware of an extraction
> function, you need to do that your self. If so, get the size
> and location information from the picture open the picture and
> read the data and spool the sub picture out to a new image file
> (with a new apropriate header), and then aplay texif_thumbnail()
> on that file - this is much easier said than done.
> 
> On how to read&write an image file, you might have alook at:
> 
> * http://netghost.narod.ru/gff/graphics/book/ch08_01.htm
> 
> to teach you some of the basic stuff, it is mainly aimed for
> C-programmes (read: real programmers :), but a skilled php
> programmer should not have that much of a trouble to be able
> to convert the code examples into php.
> 
> 
> -----Original Message-----
> From: Bobo Wieland
> To: [EMAIL PROTECTED]
> Sent: 2003-12-26 20:33
> Subject: [PHP-WIN] imagecopyresampled question
> 
> Hi all and merry christmas (and a happy new year)!
> 
> I use fixed values in this example, but of course it is variables in my
> script...
> 
> Let's say I have an image uploaded to the server: 650x400px...
> Now, I've selected a square out of this image using a flash app that
> returns
> the coordinates i've selected. The coordinates are:
> start_x:    100px;
> start_y:    120px;
> end_x:     300px; (or width:200px;)
> end_y:     350px; (or height:200px;)
> 
> No I need to use php to take this square out of the uploaded image and
> make it a 50x50px thumbnail. How should it be done?
> 
> 
> thanks for your help!
> 
> .bobo
> 
> -- 
> 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 ---
There is an extension in PECL (iisfunc) that hnadles this directly. It
works with both PHP4 and PHP5

- Frank

> I'm trying to build a few PHP scripts to administer my IIS server, and
I
> have a problem/difference in output in the COM support from PHP 4.3.4
to
> php 5b3.
> 
> I'm running php 4.3.4 and php 5beta3, both from command line, with full
> administrative priveleges on a win2k server/IIS (and if important, over
> terminal services).
> 
> If anybody has an idea why the difference in output is (change in the
> functions? bug?), I'd appreciate quite a bit.
> 
> Output is below, with the sample code. Output has been modified only to
> not give away IP address/hostname information.
> 
> Thanks in advance,
> Andrew Séguin
> 
> ----------------------------
> -------PHP 4 Output---------
> C:\php4>php -c c:\winnt\php.ini iis.class.php
> Content-type: text/html
> X-Powered-By: PHP/4.3.4
> 
> Array
> (
>     [0] => Array
>         (
>             [name] => 1
>             [ServerComment] => XXXXXXX
>             [bindings] => Array
>                 (
>                     [0] => Array
>                         (
>                             [hostheader] => xxxxxxxxxxxxxxxxxxxxxxxxx
>                             [port] => yy
>                             [ip] => zzz.zzz.zzz.zzz
>                         )
> 
>                 )
> 
>         )
> ....
> 
> 
> 
> ----------------------------
> -------PHP 5 Output---------
> C:\php4>copy iis.class.php ..\php5
> C:\php4>cd ..\php5
> C:\php5>php -c c:\winnt\php.ini iis.class.php
> Content-type: text/html
> X-Powered-By: PHP/5.0.0b3
> 
> <br />
> <b>Fatal error</b>:  Uncaught exception 'exception' with message
'Unknown
> except
> ion' in C:\php5\iis.class.php:34
> Stack trace:
> #0 C:\php5\iis.class.php(112): iis::getSites()
> #1 {main}
>   thrown in <b>C:\php5\iis.class.php</b> on line <b>34</b><br />
> 
> 
> 
> 
> 
> ------------------------------
> -------Relevant code----------
> --(line numbers in comments)--
> 
> <?php
> 
> 
> class iis {
> //...
> /*30:*/       function getSites() {
>               $iis = new COM("IIS://localhost/w3svc");
>               $retarr = array();
> 
> /*34:*/               while( $obj = $iis->Next() ) {
> 
>                       if ($obj->Class == 'IIsWebServer') {
>                               $server = array();
> 
>                               $site = new COM("IIS://Localhost/w3svc/".$obj->Name);
>                               $server['name'] = $obj->Name;
> 
>                               $server['ServerComment'] = $site->ServerComment;
>                               $bindings = $site->ServerBindings;
> 
>                               foreach($bindings as $binding) {
> 
>                                       list($b['ip'], $b['port'], $b['hostheader']) = 
> explode(':',
$binding);
>                                       $server['bindings'][] = $b;
> 
>                               }
> 
>                               unset($site);
> 
>                               $retarr[] = $server;
>                       }
>               }
>               unset($iis);
> 
>               return $retarr;
>       }
> //...
> 
> }
> 
> //echo("Max ID: " . iis::getNewSiteID() );
> /*112*/print_r( iis::getSites() );
> ?>
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Thank you for your reply... I had seen only php_iisfunc.dll very quickly
from my googling, but no info on it. Now that I realise what it is, it
will save me quite a bit of trouble (and I'll get by, I hope, on the
method declarations/source).
Thank you for developing the extension and more for letting me know about it.

Happily, A quick test (<?php echo( iis_stopservice('w3svc') ); ?>) under
php 4.3.4 worked very well.

Unfortunatly, under php5 (upon startup) I get the message "The procedure
entry point zend_hash_index_update_or_next_insert could not be located in
the dynamic link library php4ts.dll" (which then gives the message that
php_iisfunct.dll could not be loaded).

The server has the same configuration for both php4 and php5, php4ts.dll
in c:\winnt is php5's (beta3 version).
For both versions, I use php from the command line.

Is there something I'm missing out on?

Thanks in advance,
Andrew


>
> There is an extension in PECL (iisfunc) that hnadles this directly. It
> works with both PHP4 and PHP5
>
> - Frank
>
>> I'm trying to build a few PHP scripts to administer my IIS server, and
> I
>> have a problem/difference in output in the COM support from PHP 4.3.4
> to
>> php 5b3.
...

--- End Message ---

Reply via email to