mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 02:18:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@324693 c90b9560-bf6c-de11-be94-00142212c4b1
112 lines
3.2 KiB
XML
112 lines
3.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.imagecreatefromstring" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>imagecreatefromstring</refname>
|
|
<refpurpose>Create a new image from the image stream in the string</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&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 <parameter>image</parameter>.
|
|
These types will be automatically detected if your build of PHP supports
|
|
them: JPEG, PNG, GIF, WBMP, and GD2.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>image</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
A string containing the image data.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&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 recognised format,
|
|
or the image is corrupt and cannot be loaded.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="examples">
|
|
&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);
|
|
imagedestroy($im);
|
|
}
|
|
else {
|
|
echo 'An error occurred.';
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<mediaobject>
|
|
<alt>Output of example : imagecreatefromstring()</alt>
|
|
<imageobject>
|
|
<imagedata fileref="en/reference/image/figures/imagecreatefromstring.png"/>
|
|
</imageobject>
|
|
</mediaobject>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>imagecreatefromjpeg</function></member>
|
|
<member><function>imagecreatefrompng</function></member>
|
|
<member><function>imagecreatefromgif</function></member>
|
|
<member><function>imagecreatetruecolor</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|