Skip to content

Commit

Permalink
Update image
Browse files Browse the repository at this point in the history
  • Loading branch information
mowangjuanzi committed Jan 19, 2025
1 parent 0c4d248 commit 9401f6d
Show file tree
Hide file tree
Showing 20 changed files with 73 additions and 101 deletions.
11 changes: 4 additions & 7 deletions reference/image/functions/imagecopy.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: e50e79746736dbdfbabe9bd3566793b3ddf38f58 Maintainer: dallas Status: ready -->
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: dallas Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.imagecopy" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -129,19 +129,16 @@
<programlisting role="php">
<![CDATA[
<?php
// Create image instances
// 创建图像实例
$src = imagecreatefromgif('php.gif');
$dest = imagecreatetruecolor(80, 40);
// Copy
// 复制
imagecopy($dest, $src, 0, 0, 20, 13, 80, 40);
// Output and free from memory
// 输出
header('Content-Type: image/gif');
imagegif($dest);
imagedestroy($dest);
imagedestroy($src);
?>
]]>
</programlisting>
Expand Down
11 changes: 4 additions & 7 deletions reference/image/functions/imagecopymerge.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: e50e79746736dbdfbabe9bd3566793b3ddf38f58 Maintainer: dallas Status: ready -->
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: dallas Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.imagecopymerge" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -138,19 +138,16 @@
<programlisting role="php">
<![CDATA[
<?php
// Create image instances
// 创建图像实例
$dest = imagecreatefromgif('php.gif');
$src = imagecreatefromgif('php.gif');
// Copy and merge
// 复制并合并
imagecopymerge($dest, $src, 10, 10, 0, 0, 100, 47, 75);
// Output and free from memory
// 输出
header('Content-Type: image/gif');
imagegif($dest);
imagedestroy($dest);
imagedestroy($src);
?>
]]>
</programlisting>
Expand Down
11 changes: 4 additions & 7 deletions reference/image/functions/imagecopymergegray.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: e50e79746736dbdfbabe9bd3566793b3ddf38f58 Maintainer: dallas Status: ready -->
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: dallas Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.imagecopymergegray" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -140,19 +140,16 @@
<programlisting role="php">
<![CDATA[
<?php
// Create image instances
// 创建图像实例
$dest = imagecreatefromgif('php.gif');
$src = imagecreatefromgif('php.gif');
// Copy and merge - Gray = 20%
// 复制并合并 - 灰色 = 20%
imagecopymergegray($dest, $src, 10, 10, 0, 0, 100, 47, 20);
// Output and free from memory
// 输出
header('Content-Type: image/gif');
imagegif($dest);
imagedestroy($dest);
imagedestroy($src);
?>
]]>
</programlisting>
Expand Down
4 changes: 1 addition & 3 deletions reference/image/functions/imagecreate.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 593ea510e853ff034e03f78a4be0daa41661c9d4 Maintainer: dallas Status: ready -->
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: dallas Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.imagecreate" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -90,7 +90,6 @@ $background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>
]]>
</programlisting>
Expand All @@ -107,7 +106,6 @@ imagedestroy($im);
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>imagedestroy</function></member>
<member><function>imagecreatetruecolor</function></member>
</simplelist>
</refsect1>
Expand Down
13 changes: 6 additions & 7 deletions reference/image/functions/imagecreatefromgd.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 593ea510e853ff034e03f78a4be0daa41661c9d4 Maintainer: HonestQiao Status: ready -->
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.imagecreatefromgd" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand All @@ -14,7 +14,7 @@
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
从 GD 文件或 URL 新建一图像
从 GD 文件或 URL 新建图像
</para>
&tip.fopen-wrapper;
</refsect1>
Expand Down Expand Up @@ -68,20 +68,19 @@
<programlisting role="php">
<![CDATA[
<?php
// Load the gd image
// 加载 gd 图像
$im = @imagecreatefromgd('./test.gd');
// Test if the image was loaded
// 测试图像是否加载
if(!$im)
{
die('Unable to load gd image!');
}
// Do image operations here
// 这里进行图像操作
// Save the image
// 保存图像
imagegd($im, './test_updated.gd');
imagedestroy($im);
?>
]]>
</programlisting>
Expand Down
3 changes: 1 addition & 2 deletions reference/image/functions/imagecreatefromgd2.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 593ea510e853ff034e03f78a4be0daa41661c9d4 Maintainer: HonestQiao Status: ready -->
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.imagecreatefromgd2" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -81,7 +81,6 @@ if(function_exists('imagefilter'))
// 保存图像
imagegd2($im, './test_updated.gd2');
imagedestroy($im);
?>
]]>
</programlisting>
Expand Down
12 changes: 5 additions & 7 deletions reference/image/functions/imagecreatefromgd2part.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 593ea510e853ff034e03f78a4be0daa41661c9d4 Maintainer: HonestQiao Status: ready -->
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.imagecreatefromgd2part" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -100,22 +100,20 @@
<programlisting role="php">
<![CDATA[
<?php
// For this example we need the image size before
// 对于这个例子,需要先获取图像的尺寸
$image = getimagesize('./test.gd2');
// Create the image instance now we got the image
// sizes
// 现在获得了图像大小,创建图像实例
$im = imagecreatefromgd2part('./test.gd2', 4, 4, ($image[0] / 2) - 6, ($image[1] / 2) - 6);
// Do an image operation, in this case we emboss the image
// 执行图像操作,在本例中对图像进行浮雕
if(function_exists('imagefilter'))
{
imagefilter($im, IMG_FILTER_EMBOSS);
}
// Save optimized image
// 保存优化后的图像
imagegd2($im, './test_emboss.gd2');
imagedestroy($im);
?>
]]>
</programlisting>
Expand Down
11 changes: 5 additions & 6 deletions reference/image/functions/imagecreatefromgif.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 213fbd9440a224f9c1da4942c85124ce0c120c52 Maintainer: HonestQiao Status: ready -->
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.imagecreatefromgif" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -75,20 +75,20 @@
<?php
function LoadGif($imgname)
{
/* Attempt to open */
/* 尝试打开 */
$im = @imagecreatefromgif($imgname);
/* See if it failed */
/* 查看是否失败 */
if(!$im)
{
/* Create a blank image */
/* 创建空白图像 */
$im = imagecreatetruecolor (150, 30);
$bgc = imagecolorallocate ($im, 255, 255, 255);
$tc = imagecolorallocate ($im, 0, 0, 0);
imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
/* Output an error message */
/* 输出错误消息 */
imagestring ($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
}
Expand All @@ -100,7 +100,6 @@ header('Content-Type: image/gif');
$img = LoadGif('bogus.image');
imagegif($img);
imagedestroy($img);
?>
]]>
</programlisting>
Expand Down
9 changes: 4 additions & 5 deletions reference/image/functions/imagecreatefromjpeg.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 593ea510e853ff034e03f78a4be0daa41661c9d4 Maintainer: HonestQiao Status: ready -->
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.imagecreatefromjpeg" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -72,17 +72,17 @@ function LoadJpeg($imgname)
/* 尝试打开 */
$im = @imagecreatefromjpeg($imgname);
/* See if it failed */
/* 查看是否失败 */
if(!$im)
{
/* Create a black image */
/* 创建空白图像 */
$im = imagecreatetruecolor(150, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* Output an error message */
/* 输出错误消息 */
imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
}
Expand All @@ -94,7 +94,6 @@ header('Content-Type: image/jpeg');
$img = LoadJpeg('bogus.image');
imagejpeg($img);
imagedestroy($img);
?>
]]>
</programlisting>
Expand Down
11 changes: 5 additions & 6 deletions reference/image/functions/imagecreatefrompng.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 593ea510e853ff034e03f78a4be0daa41661c9d4 Maintainer: HonestQiao Status: ready -->
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.imagecreatefrompng" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -69,20 +69,20 @@
<?php
function LoadPNG($imgname)
{
/* Attempt to open */
/* 尝试打开 */
$im = @imagecreatefrompng($imgname);
/* See if it failed */
/* 查看是否失败 */
if(!$im)
{
/* Create a blank image */
/* 创建空白图像 */
$im = imagecreatetruecolor(150, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* Output an error message */
/* 输出错误消息 */
imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
}
Expand All @@ -94,7 +94,6 @@ header('Content-Type: image/png');
$img = LoadPNG('bogus.image');
imagepng($img);
imagedestroy($img);
?>
]]>
</programlisting>
Expand Down
3 changes: 1 addition & 2 deletions reference/image/functions/imagecreatefromstring.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 2bab0c8b3d7c571ef969281235a202a1d16fbfd1 Maintainer: HonestQiao Status: ready -->
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.imagecreatefromstring" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -93,7 +93,6 @@ $im = imagecreatefromstring($data);
if ($im !== false) {
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
}
else {
echo 'An error occurred.';
Expand Down
11 changes: 5 additions & 6 deletions reference/image/functions/imagecreatefromwbmp.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 593ea510e853ff034e03f78a4be0daa41661c9d4 Maintainer: HonestQiao Status: ready -->
<!-- EN-Revision: 9960a09a5705102bf4dd0ce63e03d9ec716d0015 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.imagecreatefromwbmp" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -74,20 +74,20 @@
<?php
function LoadWBMP($imgname)
{
/* Attempt to open */
/* 尝试打开 */
$im = @imagecreatefromwbmp($imgname);
/* See if it failed */
/* 查看是否失败 */
if(!$im)
{
/* Create a blank image */
/* 创建空白图像 */
$im = imagecreatetruecolor(150, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* Output an error message */
/* 输出错误消息 */
imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
}
Expand All @@ -99,7 +99,6 @@ header('Content-Type: image/vnd.wap.wbmp');
$img = LoadWBMP('bogus.image');
imagewbmp($img);
imagedestroy($img);
?>
]]>
</programlisting>
Expand Down
Loading

0 comments on commit 9401f6d

Please sign in to comment.