I've looked through the forums regarding 'require' but none of them seem to answer my question. I try to include a class and receive this error.
Fatal error: Failed opening required 'class.thumbnail.php' (include_path='.') in C:\testimage2.php
The testimage2.php has these lines.
require ('class.thumbnail.php');
$t=new PHP_Thumbnail(50, 50);
The php.ini file has
include_path="."; for the current directory.
The file 'thumbnail.php' is in the same directory as testimage2.php and is as follows.
<?php
class PHP_Thumbnail{
var $pct=true;
var $height=0;
var $width=0;
function PHP_Thumbnail($w, $h, $pct=''){
/
$w = width in pixels or percentage of the image's default width
$h = height in pixels or percentage of the image's default height
$measure = optional third argument. set it to '%' to use percentage, set it to anything but '%' (or leave it out completely) to use absolute pixels
/
if($pct != '%'){
$this->pct = false;
$this->width=abs </manual/function.abs.php>($w);
$this->height=abs </manual/function.abs.php>($h);
}else{
$this->width=($w/100);
$this->height=($h/100);
}
}
// exterior
function show($img, $extra=''){
/
$img = image file path
$extra = any extra text you want in the <img> tag, i.e. 'alt', 'border' or 'onclick', etc
$extra should look like this (single quotes or escaped doublequotes):
"alt=\"the alt tag\" onmousover=\"location.href='page.html';\""
/
if(!file_exists </manual/function.file-exists.php>($img)){
echo "<!-- file '$img' not found -->";
return false;
}
if(strlen </manual/function.strlen.php>($extra))
$extra = " ".$extra;
if($this->pct){ //show
$tmp = GetImageSize </manual/function.getimagesize.php>($img);
if($tmp){
$w=round </manual/function.round.php>($tmp[0]$this->width);
$h=round </manual/function.round.php>($tmp[1]$this->height);
echo "<img src=\"$img\" height=\"{$h}\" width=\"{$w}\"$extra>";
}else{
echo "<!-- file '$img' is not an image -->";
}
}else{
echo "<img src=\"$img\" height=\"{$this->height}\" width=\"{$this->width}\"$extra>";
}
}
function set_size($w, $h, $measure=''){
/
this function allows you to dynamically change your image sizing without
creating a new object
/
$this->PHP_Thumbnail($w, $h, $measure);
}
}
?>
Thanks for any help. Aaron