dave Thu Aug 12 15:51:01 2004 EDT
Modified files: /phpdoc/en/reference/image/functions imagecreatefromstring.xml Log: - Add info on automatically detected/supported types. Add return values, see alsos, and an example. http://cvs.php.net/diff.php/phpdoc/en/reference/image/functions/imagecreatefromstring.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc/en/reference/image/functions/imagecreatefromstring.xml diff -u phpdoc/en/reference/image/functions/imagecreatefromstring.xml:1.3 phpdoc/en/reference/image/functions/imagecreatefromstring.xml:1.4 --- phpdoc/en/reference/image/functions/imagecreatefromstring.xml:1.3 Thu Apr 18 13:13:09 2002 +++ phpdoc/en/reference/image/functions/imagecreatefromstring.xml Thu Aug 12 15:51:01 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/image.xml, last change in rev 1.31 --> <refentry id="function.imagecreatefromstring"> <refnamediv> @@ -7,14 +7,61 @@ <refpurpose>Create a new image from the image stream in the string</refpurpose> </refnamediv> <refsect1> - <title>Description</title> + &reftitle.description; <methodsynopsis> <type>resource</type><methodname>imagecreatefromstring</methodname> <methodparam><type>string</type><parameter>image</parameter></methodparam> </methodsynopsis> <para> <function>imagecreatefromstring</function> returns an image identifier - representing the image obtained from the given string. + representing the image obtained from the given string. These types + will be automatically detected if your build of PHP supports them: + JPEG, PNG, GIF, WBMP, and GD2. + </para> + </refsect1> + <refsect1> + &reftitle.returnvalues; + <para> + An image resource will be returned on success. &false; is returned if + the image type is unsupported, the data is not in a recogised format, + or the image is corrupt and cannot be loaded. + </para> + </refsect1> + <refsect1> + &reftitle.seealso; + <para> + <function>imagecreatefromjpeg</function>, + <function>imagecreatefrompng</function>, + <function>imagecreatefromgif</function>&listendand; + <function>imagecreate</function> + </para> + </refsect1> + <refsect1> + &reftitle.examples; + <para> + <example> + <title><function>imagecreatefromstring</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$data = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABl' + . 'BMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDr' + . 'EX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r' + . '8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg=='; +$data = base64_decode($data); + +$im = imagecreatefromstring($data); +if ($im !== false) { + header('Content-Type: image/png'); + imagepng($im); +} +else { + echo 'An error occured.'; +} +?> +]]> + </programlisting> + </example> </para> </refsect1> </refentry>