Hi all,

 

First, I wanna say thank you to the founders of this very nice open source PEL. 
Second, I have a problem regarding setThumbnail img and need your helps. Here 
is my code:

//-------------------------------------------------------------------------------------------------

//create thumbnail img

$img = imagecreatefromjpeg("./I1.JPG");

$thumb = create_thumbnail_image($img, 0.1); //create a thumbnail image with 
size = 10% of its org

   

//insert new thumbnail to img

$jpeg = new PelJpeg();

$jpeg->loadFile("./I1.JPG");   

$exif = $jpeg->getExif();

$tiff = $exif->getTiff();

$ifd0 = $tiff->getIfd();

$ifd0->setThumbnail(new PelDataWindow($thumb));

$jpeg->setExif($exif);

   

//write to file

file_put_contents("./out.jpg",$jpeg->getBytes());

//-------------------------------------------------------------------------------------------------

 

Running above code, I got this exception:

//-------------------------------------------------------------------------------------------------

Fatal error: Uncaught exception 'PelDataWindowOffsetException' with message 
'Offset -1 not within [0, 14]' in 
D:\Projects\MIP\WIP\Source\MIP-Server\lib\pel\PelDataWindow.php:243 Stack 
trace: #0 D:\Projects\MIP\WIP\Source\MIP-Server\lib\pel\PelDataWindow.php(303): 
PelDataWindow->validateOffset(-1) #1 
D:\Projects\MIP\WIP\Source\MIP-Server\lib\pel\PelIfd.php(549): 
PelDataWindow->getByte(-1) #2 
D:\Projects\MIP\WIP\Source\MIP-Server\web\thumb.php(17): 
PelIfd->setThumbnail(Object(PelDataWindow)) #3 {main} thrown in 
D:\Projects\MIP\WIP\Source\MIP-Server\lib\pel\PelDataWindow.php on line 243

//-------------------------------------------------------------------------------------------------

This is due to a incorrect $thumb data is set to the PelDataWindow constructor. 
What kind of thumbnail data will I need to set to the PelDataWindow 
constructor? Any idea will be much appreciated. Thank you.

VanPH

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
PEL-devel mailing list
PEL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pel-devel

Reply via email to