Jump to content

Mistake in resize script...


Rochtus

Recommended Posts

I don't know what is wrong:s

It doesn't give a error

it doesn't display anything

 

 

<?php

ob_start();

$filename = "../images/pics/SP_A0002.jpg";

 

 

// Set a maximum height and width

$width = 200;

$height = 200;

 

// Content type

header('Content-type: image/jpeg');

 

 

// Get new dimensions

list($width_orig, $height_orig) = getimagesize($filename);

 

$ratio_orig = $width_orig/$height_orig;

 

if ($width/$height > $ratio_orig) {

  $width = $height*$ratio_orig;

} else {

  $height = $width/$ratio_orig;

}

 

// Resample

$image_p = imagecreatetruecolor($width, $height);

$image = imagecreatefromjpeg($filename);

imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);

 

// Output

imagejpeg($image_p, null, 100);

 

ob_end_clean();

?>

Link to comment
https://forums.phpfreaks.com/topic/163140-mistake-in-resize-script/
Share on other sites

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.