Jump to content

[SOLVED] Image Resize Help! Image isn't showing up. Why?


Trium918

Recommended Posts

Can someone help with this Thanks?

Why the image isn't show up?

 

<?php

if (!$max_width)
  $max_width = 80;
if (!$max_height)
  $max_height = 60;

$size = GetImageSize($image);
$width = $size[0];
$height = $size[1];

$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;

if ( ($width <= $max_width) && ($height <= $max_height) ) {
  $tn_width = $width;
  $tn_height = $height;
}
else if (($x_ratio * $height) < $max_height) {
  $tn_height = ceil($x_ratio * $height);
  $tn_width = $max_width;
}
else {
  $tn_width = ceil($y_ratio * $width);
  $tn_height = $max_height;
}

$src = imagecreatefromjpeg($image);
$dst = imagecreate($tn_width,$tn_height);
imagecopyresized($dst, $src, 0, 0, 0, 0,
$tn_width,$tn_height,$width,$height);
header("Content-type: image/jpeg");
imagejpeg($dst, null, -1);
imagedestroy($src);
imagedestroy($dst);

?>

 

picture.php

<?php
echo "<IMG SRC=\"resize_image.php?image= 3b.jpg\">";
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.