mirror of
https://github.com/php/doc-es.git
synced 2026-03-23 23:12:09 +01:00
149 lines
4.2 KiB
XML
149 lines
4.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
<refentry xml:id="function.imagecreatefromstring" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>imagecreatefromstring</refname>
|
|
<refpurpose>Crea una imagen a partir de una cadena</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>GdImage</type><type>false</type></type><methodname>imagecreatefromstring</methodname>
|
|
<methodparam><type>string</type><parameter>data</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagecreatefromstring</function> devuelve un identificador de imagen
|
|
que representa la imagen obtenida desde la cadena <parameter>data</parameter>.
|
|
El tipo de la imagen será detectado automáticamente si PHP ha sido compilado con
|
|
soporte para: JPEG, PNG, GIF, BMP, WBMP, GD2, WEBP y AVIF.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>data</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Una cadena que contiene los datos de la imagen.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Un objeto de imagen será devuelto en caso de éxito. &false; es devuelto si
|
|
el tipo de la imagen no es soportado, si los datos no están en un formato reconocido
|
|
o si la imagen está corrupta y por lo tanto no puede ser cargada.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
<function>imagecreatefromstring</function> emite un error de nivel
|
|
E_WARNING si los datos no están en un formato reconocido.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.0.0</entry>
|
|
<entry>
|
|
En caso de éxito, esta función devuelve ahora una instancia de
|
|
<classname>GDImage</classname>; anteriormente,
|
|
se devolvía un <type>resource</type>.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>7.3.0</entry>
|
|
<entry>
|
|
WEBP es soportado ahora (si es soportado por la libgd utilizada).
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo con <function>imagecreatefromstring</function></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 occurred.';
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<mediaobject>
|
|
<alt>Visualización del ejemplo: imagecreatefromstring()</alt>
|
|
<imageobject>
|
|
<imagedata fileref="en/reference/image/figures/imagecreatefromstring.png"/>
|
|
</imageobject>
|
|
</mediaobject>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><function>imagecreatefromjpeg</function></member>
|
|
<member><function>imagecreatefrompng</function></member>
|
|
<member><function>imagecreatefromgif</function></member>
|
|
<member><function>imagecreatetruecolor</function></member>
|
|
</simplelist>
|
|
</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
|
|
-->
|