Page 1 of 1

error logs

Posted: Sun Jan 04, 2009 7:28 am
by rc726c
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"]);


?>

Re: error logs

Posted: Sun Jan 04, 2009 7:59 am
by requinix
[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
"../admin/conn.inc" is relative to the current working directory, not the directory containing the file doing the include (/online/duckula).
Use absolute paths like

Code: Select all

include_once($_SERVER["DOCUMENT_ROOT"] . "/online/admin/conn.inc");
(or whatever the correct path is)
[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/
I don't know what you were trying to do, but remove the $image_data= from each of the three if blocks near the bottom.

Re: error logs

Posted: Sun Jan 04, 2009 8:09 am
by rc726c
thank u so much.

how about this? is this code gets an error?

<?

/*
===================================
+ 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"]);


?>

Re: error logs

Posted: Sun Jan 04, 2009 8:40 am
by rc726c
its not working...

could someone hepl me to solve the second problem?