Hey everyone..
Before i get started... I figure I should tell you that according to phpinfo(); I have
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
I'm trying to use this script
$desc=$result['descrip'];
$date=$result['name'];
$locked=$result['locked'];
$pic_name=$result['pic_name'];
$link_db=$result['db_table'];
# Constants
define(IMAGE_BASE, '/homepages/13/d153872232/htdocs/photos/images');
define(MAX_WIDTH, 150);
define(MAX_HEIGHT, 150);
# Get image location
$image_file = str_replace('..', '', $_SERVER['QUERY_STRING']);
$image_path = IMAGE_BASE . "/$pic_name";
# Load image
$img = null;
$ext = strtolower(end(explode('.', $image_path)));
if ($ext == 'jpg' || $ext == 'jpeg') {
echo'you made it here';
$img = imagecreatefromjpeg($image_path);
echo'you made it here';
echo $img;
}
if ($ext == 'png') {
$img = @imagecreatefrompng($image_path);
# Only if your version of GD includes GIF support
}
else if ($ext == 'gif') {
$img = @imagecreatefrompng($image_path);
}
# If an image was successfully loaded, test the image for size
if ($img) {
# Get image size and scale ratio
$width = imagesx($img);
$height = imagesy($img);
$scale = min(MAX_WIDTH/$width, MAX_HEIGHT/$height);
# If the image is larger than the max shrink it
if ($scale < 1) {
$new_width = floor($scale*$width);
$new_height = floor($scale*$height);
# Create a new temporary image
$tmp_img = imagecreatetruecolor($new_width, $new_height);
# Copy and resize old image into new image
imagecopyresampled($tmp_img, $img, 0, 0, 0, 0,
$new_width, $new_height, $width, $height);
imagedestroy($img);
$img = $tmp_img;
}
}
# Create error image if necessary
if (!$img) {
$img = imagecreate(MAX_WIDTH, MAX_HEIGHT);
imagecolorallocate($img,0,0,0);
$c = imagecolorallocate($img,70,70,70);
imageline($img,0,0,MAX_WIDTH,MAX_HEIGHT,$c2);
imageline($img,MAX_WIDTH,0,0,MAX_HEIGHT,$c2);
echo'you made it here';
}
# Display the image
echo'
<table width="200" border="1">
<tr>
<td>
<center>
Posted on<br />
'.$date.'<br />
<a href="http://photo.nightlance.com/?view='.$link_db.'">';
header("Content-type: image/jpeg");
imagejpeg($img);
echo'
</a>
<br />
'.$desc.'
<br />
</center>
</td>
</tr>
</table>
';
and it is not going any further then.
# Load image
$img = null;
$ext = strtolower(end(explode('.', $image_path)));
if ($ext == 'jpg' || $ext == 'jpeg') {
echo'you made it here';
$img = imagecreatefromjpeg($image_path);
echo'you made it here';
echo $img;
}
if ($ext == 'png') {
$img = @imagecreatefrompng($image_path);
# Only if your version of GD includes GIF support
}
else if ($ext == 'gif') {
$img = @imagecreatefrompng($image_path);
}
it's exactly failing @ $img = imagecreatefromjpeg($image_path);
And I have no idea why...
it displays the first "you made it here" but not the 2nd.. which is how i know where it's failing.