#49595 [Opn->Csd]: Incorrect example code

From: Date: Sun, 20 Sep 2009 08:50:40 +0000
Subject: #49595 [Opn->Csd]: Incorrect example code
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2795@lists.php.net to get a copy of this message
ID: 49595 Updated by: torben@php.net Reported By: nilesprague at gmail dot com -Status: Open +Status: Closed Bug Type: Documentation problem PHP Version: Irrelevant New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2009-09-20 08:50:18] svn@php.net Automatic comment from SVN on behalf of torben Revision: http://svn.php.net/viewvc/?view=revision&revision=288470 Log: Allow the example for iptcembed to write its result to the original .jpg file. Addresses bug #49595. ------------------------------------------------------------------------ [2009-09-18 22:40:16] nilesprague at gmail dot com Description: ------------ Two problems with the example code on the documentation page, and as a result, the code does not work: 1) The code is incomplete. The $content variable must be written to the image file to apply the changes - that is, to write the iptc data to the image file. The following code must be added at the end of the example: $fp = fopen($path, "wb"); fwrite($fp, $content); fclose($fp); 2) The $tag variable is being "substr" twice, but this should only be done once. The existing code is this: $tag = substr($tag, 2); $data .= iptc_make_tag(2, substr($tag, 2), $string); And should be changed to this: $data .= iptc_make_tag(2, substr($tag, 2), $string); Reproduce code: --------------- --- From manual page: function.iptcembed --- ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49595&edit=1

« previous php.doc.bugs (#2795) next »