Jump to content
php.lv forumi

imagecreatefromjpeg - invalīds JPEG fails


Toms

Recommended Posts

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
Link to comment
Share on other sites

<?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 );

?>

Link to comment
Share on other sites

×
×
  • Create New...