Re: [PEL] PelIfd.setThumbnail (PelDataWindow $d) doesn't work!
Pham Hoai Van [EMAIL PROTECTED] writes: Hi! First, I wanna say thank you to the founders of this very nice open source PEL. Thanks, I appreciate it! 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); Just a hint: you can now simply do $jpeg = new PelJpeg(./I1.JPG); and PEL will load the data from the file. $exif = $jpeg-getExif(); $tiff = $exif-getTiff(); $ifd0 = $tiff-getIfd(); $ifd0-setThumbnail(new PelDataWindow($thumb)); $jpeg-setExif($exif); Another hint: this is not necessary (it does nothing in this case). When the $exif object is changed, then $jpeg will see the change as well since $jpeg has a reference (pointer) to $exif. 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. The thumbnail data is supposed to be JPEG normal data, wrapped in a PelDataWindow. I assume your create_thumbnail_image() function return an Image resource like the ImageCreateFromJpeg() function? If so, then you need to extract the JPEG data from this resource. I've just committed some code that will let you do what you tried: construct a PelDataWindow from an image resource. So you can update From SVN and it should work. Or you can use this piece of code: ob_start(); ImageJpeg($thumb); $window = new PelDataWindow(ob_get_clean()); $window now has your data and you should be able to use it with the setThumbnail() method. As a side remark, then why do you want to update the thumbnail? The Exif standard indicates that the thumbnail should always be 160x120 pixels. You're not even allowed to rotate it which is kind of silly... Anyway, please let me know if the new code works as expected. -- Martin Geisler --- [EMAIL PROTECTED] --- http://mgeisler.net Read, write, create Exif data in PHP with PEL: http://pel.sf.net Take control of your webserver with PHP Shell: http://phpshell.sf.net pgpDVUTtEI3C9.pgp Description: PGP signature - 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.phpp=sourceforgeCID=DEVDEV___ PEL-devel mailing list PEL-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pel-devel
Re: pel and php 5.0.3
On 16 maj 2006, [EMAIL PROTECTED] wrote: Hi Michael I haven't left yet for my trip to Switzerland, so I can just answer this one... I don't get pel to work with php 5.0.3 - I always get a result file of 0kb I tried with 5.1.1 too and and then some duplicate constants where found. I removed them and then at least I go an output image. Does anyone know about a restriction of 5.0.3? I believe there has been some trouble with the different 5.x versions of PHP -- I'm not sure if this is the fault of PEL or what. But I would recommend that you upgrade to version 5.1 if you have the chance. -- Martin Geisler GnuPG Key: 0x7E45DD38 PHP Exif Library | PHP Weather | PHP Shell http://pel.sf.net/| http://phpweather.net/ | http://mgeisler.net/ Read/write Exif data | Show current weather| A shell in a browser pgpWV18d6n2kn.pgp Description: PGP signature
Re: Pel minimal version
TinyWebGallery [EMAIL PROTECTED] writes: Hi Michael, I would appreciate it if you could follow up to the PEL development list too so that the messages can be archived. Go to https://lists.sourceforge.net/lists/listinfo/pel-devel to subscribe. I have a nice webgallery (www.tinywebgallery.com) and want to integrate pel to my application because I want to keep the exif info if someone uploads images and select my resize option. Right now the exif data is lost. Good idea -- having a simple resize_and_keep_my_exif_data() function would be a nice feature (probably with a shorter name, though...) Do you have a minimal version where I simply read about 8 tags from the exif data and write it to the new file again? No, there is no such thing right now. But the core of PEL isn't that big anyway: I just downloaded PEL 0.9 and after removing the doc, test, po, locale, and examples directories I ended up with 644 KiB of uncompressed code. Zipping that up gives me 123 KiB. Going for bzip2 is even better: just 71 KiB. I saw your zip download is 1.8 MiB, so is 123 KiB really that much of a problem? Since you know which tags you want you could even trim the content of the files. Simply removing all comments, squizzing multiple blank lines into one, and removing INSTALL, NEWS, etc. gets the zip file down to just 41 KiB. Its for jpgs only. I want to keep my download as small as possible (its too big already :() I don't know how big a role that plays today, but 1.8 MiB sounds like a lot of a gallery that calls itself tiny :-) But I'm sure that it has lots of features and they come at a price. Thanks, Michael -- Martin Geisler GnuPG Key: 0x7E45DD38 PHP Exif Library | PHP Weather | PHP Shell http://pel.sf.net/| http://phpweather.net/ | http://mgeisler.net/ Read/write Exif data | Show current weather| A shell in a browser --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ PEL-devel mailing list PEL-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pel-devel
Re: PEL library support
P, I was so tired I have forgotten, I have sent the first mail I hope I'm not in your spammer list !!! :-) Once again thanks Max and Max - Original Message - From: Martin Geisler To: pel-devel@lists.sourceforge.net Sent: Saturday, March 04, 2006 12:51 PM Subject: Fwd: PEL library support Another mail from Max :-)- Forwarded message from [EMAIL PROTECTED] - Date: Fri, 3 Mar 2006 19:28:01 +0100 From: Max [EMAIL PROTECTED]Reply-To: Max [EMAIL PROTECTED]Subject: PEL library support To: [EMAIL PROTECTED]HelloI'm french and i have some problems to show XP tags.I think that XP tags are commonly in the IFD0.I tried this code:require_once("peljpeg.php");$filename="J:/TEMP/BUFFER/IMG_6717.JPG";$jpeg = new PelJpeg();$jpeg-loadFile($filename);$app1=$jpeg-getSection(PelJpegMarker::APP1);$tiff = $app1-getTiff();$ifd0 = $tiff-getIfd();echo $ifd0[XP_AUTHOR];but it doesn't work. I explore all the IFDS, but they are never the XP Tags,only classic tags (MODELE, RESOLUTION )I hope you have understood me thxmax- End forwarded message --- Martin Geisler Hello I'm french and i have some problems to show XP tags. I think that XP tags are commonly in the IFD0. I tried this code: require_once("peljpeg.php"); $filename="J:/TEMP/BUFFER/IMG_6717.JPG";$jpeg = new PelJpeg();$jpeg-loadFile($filename); $app1=$jpeg-getSection(PelJpegMarker::APP1);$tiff = $app1-getTiff(); $ifd0 = $tiff-getIfd(); echo $ifd0[XP_AUTHOR]; but it doesn't work. I explore all the IFDS, but they are never the XP Tags, only classic tags (MODELE, RESOLUTION ) I hope you have understood me thx max