Hello,

Jtjohnston wrote:

> See these. Reduire.phps probably has what you want.
>  http://www.collegesherbrooke.qc.ca/si/php/exemples/photos/reduire.phps

This is what I was looking for I think..  But it still gives me an 
error..  This one actually got inserted right into the database:

<br> <b>Warning</b>: Data is not in a recognized format. in 
<b>/home/mike/wtoaction/public_html/caravan2001/edit_image_handler.php</b> 
on line <b>65</b><br> <br> <b>Warning</b>: Supplied argument is not a 
valid Image resource in 
<b>/home/mike/wtoaction/public_html/caravan2001/edit_image_handler.php</b> 
on line <b>34</b><br> <br> <b>Warning</b>: Supplied argument is not a 
valid Image resource in 
<b>/home/mike/wtoaction/public_html/caravan2001/edit_image_handler.php</b> 
on line <b>40</b><br>

This is these are the relenvant pieces of the code..

Any suggestions would be appreciated..

Mike

<?php php_track_vars?>
<?php

include "config.inc.php";
include "$baseDIR/php-dbi.inc";
include "$baseDIR/connect.inc";
include "$baseDIR/misc.inc";

function ResizeImage( $srcImage, $srcWidth, $srcHeight, $xscale, $yscale) {
// http://www.collegesherbrooke.qc.ca/si/php/exemples/photos/reduire.phps
        //obtain the original image Height and Width
                // $srcWidth = ImageSX( $srcImage );
                // $srcHeight = ImageSY( $srcImage );

        // the following portion of code checks to see if
        // the width > height or if width < height
        // if so it adjust accordingly to make sure the image
        // stays smaller then the $newWidth and $newHeight
                // $ratioWidth = $srcWidth/$newWidth;
                // $ratioHeight = $srcHeight/$newHeight;

        // if( $ratioWidth < $ratioHeight){
                // $destWidth = $srcWidth/$ratioHeight;
                // $destHeight = $newHeight;
        // }else{
                // $destWidth = $newWidth;
                // $destHeight = $srcHeight/$ratioWidth;
        // }
        
        $destWidth = $srcWidth * $xscale;
        $destHeight = $srcHeight * $yscale;

        $destImage = imagecreate($destWidth, $destHeight);
        ImageCopyResized( $destImage, $srcImage, 0, 0, 0, 0, $destWidth, 
$destHeight, $srcWidth, $srcHeight );
        
        //  (changer selon le genre)
        ImageJPEG($destImage,"",100);
        
        //free the memory used for the images
        ImageDestroy( $srcImage );
        ImageDestroy( $destImage );
}

if(!isAdmin())
{
     die("Must be admin!");
}

if(!isset($ID)) { die("You must have an ID to proceed"); }

if($ReThumbnail) {
        ob_start();
        
        $sql = "SELECT Image FROM Images,Width,Height WHERE ID='$ID'";
        $res = dbi_query ( $sql );
        if ( $res ) {
          if($row = dbi_fetch_row( $res ))
          dbi_free_result ( $res );
          $Images = stripslashes($row[0]);
          $Width = stripslashes($row[1]);
          $Height = stripslashes($row[2]);
        }
        // echo "Image: <br>$Images";
        
        $srcimage = imagecreatefromstring($Images);
        ResizeImage( $srcImage, $Width, $Height, $xscale, $yscale);

        //copy output buffer to string
        $resizedImage = ob_get_contents();
        //clear output buffer that was saved
        ob_end_clean();
        $tmb = addslashes($resizedImage);

        $sql = "UPDATE Images SET Thumbnail='$tmb' WHERE ID=$ID";
        if(dbi_query($sql)) {
                echo "ReThumbnailing Successful";
                exit;
        } else {
                $error = dbi_error ();
        }
}


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to