Jump to content
php.lv forumi

imagecreatefromjpeg - invalīds JPEG fails


Recommended Posts

Posted (edited)

man toch nepaliidz. meegjinaaji ar tiem manis dotajiem bilzhu failiem?

Varbuut man kkas ne taa...

 

P.S. kaa lai nosaka vai taam bildeem vajadziiga speciaala apstraade? "Labajaam" JPEG bildeem negribas laist shito virsuu. Tas aiznjem laiku..

Edited by Toms
Posted
<?php

error_reporting( 32 );
header( 'Content-Type: image/jpeg' );

$imgPath = 'att.jpg';

// Atdod atpakaļ GD_ImageResource
function imageCreateFromJpegEx($file)
{
$data = file_get_contents($file);
$im = @imagecreatefromstring($data);
$i = 0;
while (!$im)
{
	$data = substr_replace($data, "", -3, -2);
	$im = @imagecreatefromstring($data);
}
return $im;
}

$im = imageCreateFromJpegEx($imgPath);
imagejpeg( $im );

?>

×
×
  • Create New...