Jump to content

resizing jpeg results in black image


luckylooke

Recommended Posts

this is the code

<?php
	$image = imagecreatefromjpeg("9t4i_200xX.jpg");
	$new_image = imagecreatetruecolor(120,90);
	imagecopyresampled($new_image, $image, 0, 0, 0, 0, 120, 90, imagesx($image), imagesy($image));
	$image = $new_image;
	imagejpeg($image,"images/test.jpg");
?>

result is black jpeg image of size 120,90

I dont understand where could be the problem

SimpleImage.php script doesnt work either

Link to comment
https://forums.phpfreaks.com/topic/226597-resizing-jpeg-results-in-black-image/
Share on other sites

this is the code

<?php
	$image = imagecreatefromjpeg("9t4i_200xX.jpg");
	$new_image = imagecreatetruecolor(120,90);
	imagecopyresampled($new_image, $image, 0, 0, 0, 0, 120, 90, imagesx($image), imagesy($image));
	$image = $new_image;
	imagejpeg($image,"images/test.jpg");
?>

result is black jpeg image of size 120,90

I dont understand where could be the problem

SimpleImage.php script doesnt work either

 

Really simple solution:

$image = imagecreatefromjpeg("images/9t4i_200xX.jpg");

 

Question is why it did work before... I havent change my code when it stoped working.

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.