Jump to content

Recommended Posts

could someone tell me "why am i takeing these error codes?"

 

---- first error code is about include function:

[Wed Dec 10 01:06:14 2008] [error] [client 88.xxx.xxx.216] PHP Warning: include_once() [<a href='function.include'>function.include</a>]: Failed opening '../admin/conn.inc' for inclusion (include_path='.:/usr/share/pear') in /var/www/html/w/htdocs/online/duckula/ustbilgi.php on line 32

 

my include code is: include_once("../admin/conn.inc"); (adress is correct,mysql connection is working)

(there is connection codes(username,password etc) in conn.inc)

 

---- the second error code is about imagedestroy function:

[Wed Dec 10 02:58:05 2008] [error] [client 195.xxx.xx.32] PHP Warning: imagedestroy(): supplied argument is not a valid Image resource in /var/www/html/w/htdocs/online/duckula/fotolar/thumb.php on line 47, referer: http://www.site.com/

 

and this is the tumb.php:

<?

 

/*

===================================

+ yThumb Class

+ Author: Yunus Emre Yilmaz

+ http://yns.zaxaz.com/ythumb.yns

===================================

*/

 

class yThumb {

 

// find extension of file

function find_extension($file) {

$array = explode('.',$file);

$key = count($array) -1;

$ext = $array[$key];

return $ext;

}

 

function thumb($image,$w,$h) {

if($this->find_extension($image) == 'jpg') $image_data = imagecreatefromjpeg($image);

if($this->find_extension($image) == 'gif') $image_data = imagecreatefromgif ($image);

if($this->find_extension($image) == 'png') $image_data = imagecreatefrompng ($image);

 

// Original width && height

$width = imagesx($image_data);

$height = imagesy($image_data);

 

// Control width && and height

if(@$w > 800 || @$h > 800) {

$w= $width; $h= $height;

}

 

if(@empty($w)) $w = 400;

if(@empty($h)) $h = 600;

 

$new = imagecreatetruecolor($w, $h);

imagecopyresampled($new, $image_data, 0, 0, 0, 0, $w, $h, $width, $height);

 

// Finally, output..

if($this->find_extension($image) == 'jpg') $image_data = imagejpeg($new);

if($this->find_extension($image) == 'gif') $image_data = imagegif ($new);

if($this->find_extension($image) == 'png') $image_data = imagepng ($new);

 

// Flush memory

imagedestroy($image_data); // line 47

imagedestroy($new);

}

 

}

 

$a = new yThumb();

$a->thumb($_GET["image"],@$_GET["w"],@$_GET["h"]);

 

 

?>

Link to comment
https://forums.phpfreaks.com/topic/139421-error-logs/
Share on other sites

As for the second error, change

 

/ Finally, output..
if($this->find_extension($image) == 'jpg') $image_data = imagejpeg($new);
if($this->find_extension($image) == 'gif') $image_data = imagegif ($new);
if($this->find_extension($image) == 'png') $image_data = imagepng ($new);

 

to:

$data = pathinfo($image);

switch(strtolower($data['extension']))
{
    case 'gif':
        $image_data = imagegif($new);
    break;

    case 'png':
        $image_data = imagepng($new);
    break;

    case 'jpg':
    default:
        $image_data = imagejpeg($new);
    break;
}

if(isset($image_data))
{
    imagedestroy($image_data);
    imagedestroy($new);
}
else
{
    die('Error processing thumbnail');
}

 

For you first error. PHP will convert the following path ../admin/conn.inc to /var/www/html/w/htdocs/online/admin/conn.inc is this the correct path?

 

 

Link to comment
https://forums.phpfreaks.com/topic/139421-error-logs/#findComment-729316
Share on other sites

and for second problem, i did like this:

is this alright?

 

<?

 

/*

===================================

+ yThumb Class

+ Author: Yunus Emre Yilmaz

+ http://yns.zaxaz.com/ythumb.yns

===================================

*/

 

class yThumb {

       

    // find extension of file

    function find_extension($file) {

    $array = explode('.',$file);

    $key  = count($array) -1;

    $ext  = $array[$key];

    return $ext;

    }

 

    function thumb($image,$w,$h) {

    if($this->find_extension($image) == 'jpg') $image_data = imagecreatefromjpeg($image);

    if($this->find_extension($image) == 'gif') $image_data = imagecreatefromgif ($image);

    if($this->find_extension($image) == 'png') $image_data = imagecreatefrompng ($image);

   

    // Original width && height

    $width  = imagesx($image_data);

    $height = imagesy($image_data);

   

    // Control width && and height

    if(@$w > 800 || @$h > 800) {

        $w= $width; $h= $height;

    }

   

    if(@empty($w)) $w = 400;

    if(@empty($h)) $h = 600;   

 

    $new = imagecreatetruecolor($w, $h);

    imagecopyresampled($new, $image_data, 0, 0, 0, 0, $w, $h, $width, $height);

   

    // Finally, output..

$data = pathinfo($image);

 

switch(strtolower($data['extension']))

{

    case 'gif':

        $image_data = imagegif($new);

    break;

 

    case 'png':

        $image_data = imagepng($new);

    break;

 

    case 'jpg':

    default:

        $image_data = imagejpeg($new);

    break;

}

 

if(isset($image_data))

{

    imagedestroy($image_data);

    imagedestroy($new);

}

else

{

    die('Error processing thumbnail');

}

 

    // Flush memory

    imagedestroy($image_data);

    imagedestroy($new);

    }

   

}

 

$a = new yThumb();

$a->thumb($_GET["image"],@$_GET["w"],@$_GET["h"]);

 

 

?>

Link to comment
https://forums.phpfreaks.com/topic/139421-error-logs/#findComment-729319
Share on other sites

should i include like this:

include_once("/var/www/html/w/htdocs/online/admin/conn.inc ");

No, I was just confirming whether /var/www/html/w/htdocs/online/admin/conn.inc Is the correct full path to the file you're trying to include? If so your relative path should work. However you could use

include_once($_SERBER['DOCUMENT_ROOT']."/admin/conn.inc"); 

 

Also note, using .inc is insecure as your PHP code will displayed as plain text. You should use the following name convention instead filename.inc.php this will prevent your source code from being displayed and improve security.

 

and for second problem, i did like this:

is this alright?

 

<? 

/* 
=================================== 
+ yThumb Class 
+ Author: Yunus Emre Yilmaz 
+ http://yns.zaxaz.com/ythumb.yns 
=================================== 
*/ 

class yThumb { 
         
    // find extension of file 
    function find_extension($file) { 
    $array = explode('.',$file); 
    $key   = count($array) -1; 
    $ext   = $array[$key]; 
    return $ext; 
    } 

    function thumb($image,$w,$h) { 
    if($this->find_extension($image) == 'jpg') $image_data = imagecreatefromjpeg($image); 
    if($this->find_extension($image) == 'gif') $image_data = imagecreatefromgif ($image); 
    if($this->find_extension($image) == 'png') $image_data = imagecreatefrompng ($image); 
     
    // Original width && height 
    $width  = imagesx($image_data); 
    $height = imagesy($image_data); 
     
    // Control width && and height 
    if(@$w > 800 || @$h > 800) { 
        $w= $width; $h= $height; 
    } 
    
    if(@empty($w)) $w = 400; 
    if(@empty($h)) $h = 600;     

    $new = imagecreatetruecolor($w, $h); 
    imagecopyresampled($new, $image_data, 0, 0, 0, 0, $w, $h, $width, $height); 
     
    // Finally, output.. 
$data = pathinfo($image);

switch(strtolower($data['extension']))
{
    case 'gif':
        $image_data = imagegif($new);
    break;

    case 'png':
        $image_data = imagepng($new);
    break;

    case 'jpg':
    default:
        $image_data = imagejpeg($new);
    break;
}

if(isset($image_data))
{
    imagedestroy($image_data);
    imagedestroy($new);
}
else
{
    die('Error processing thumbnail');
}

    // Flush memory 
    imagedestroy($image_data); 
    imagedestroy($new); 
    } 
     
} 

$a = new yThumb(); 
$a->thumb($_GET["image"],@$_GET["w"],@$_GET["h"]); 


?>

Remove

    // Flush memory
    imagedestroy($image_data);
    imagedestroy($new);
    }

Link to comment
https://forums.phpfreaks.com/topic/139421-error-logs/#findComment-729321
Share on other sites

ok i understand... thank u so much..

but this code is not working? could u try it on your own computer?

 

<?

 

/*

===================================

+ yThumb Class

+ Author: Yunus Emre Yilmaz

+ http://yns.zaxaz.com/ythumb.yns

===================================

*/

 

class yThumb {

       

    // find extension of file

    function find_extension($file) {

    $array = explode('.',$file);

    $key  = count($array) -1;

    $ext  = $array[$key];

    return $ext;

    }

 

    function thumb($image,$w,$h) {

    if($this->find_extension($image) == 'jpg') $image_data = imagecreatefromjpeg($image);

    if($this->find_extension($image) == 'gif') $image_data = imagecreatefromgif ($image);

    if($this->find_extension($image) == 'png') $image_data = imagecreatefrompng ($image);

   

    // Original width && height

    $width  = imagesx($image_data);

    $height = imagesy($image_data);

   

    // Control width && and height

    if(@$w > 800 || @$h > 800) {

        $w= $width; $h= $height;

    }

   

    if(@empty($w)) $w = 400;

    if(@empty($h)) $h = 600;   

 

    $new = imagecreatetruecolor($w, $h);

    imagecopyresampled($new, $image_data, 0, 0, 0, 0, $w, $h, $width, $height);

   

    // Finally, output..

$data = pathinfo($image);

 

switch(strtolower($data['extension']))

{

    case 'gif':

        $image_data = imagegif($new);

    break;

 

    case 'png':

        $image_data = imagepng($new);

    break;

 

    case 'jpg':

    default:

        $image_data = imagejpeg($new);

    break;

}

 

if(isset($image_data))

{

    imagedestroy($image_data);

    imagedestroy($new);

}

else

{

    die('Error processing thumbnail');

}

 

 

   

}

 

$a = new yThumb();

$a->thumb($_GET["image"],@$_GET["w"],@$_GET["h"]);

 

 

?>

Link to comment
https://forums.phpfreaks.com/topic/139421-error-logs/#findComment-729323
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.