Skip to content

Commit 9960a09

Browse files
authored
gd: do not use or unnecessary reference imagedestroy() (#4396)
1 parent 5783476 commit 9960a09

File tree

79 files changed

+8
-183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+8
-183
lines changed

reference/image/examples.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ $orange = imagecolorallocate($im, 220, 210, 60);
1919
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
2020
imagestring($im, 3, $px, 9, $string, $orange);
2121
imagepng($im);
22-
imagedestroy($im);
2322
2423
?>
2524
]]>
@@ -57,10 +56,9 @@ $sy = imagesy($stamp);
5756
// width to calculate positioning of the stamp.
5857
imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
5958
60-
// Output and free memory
59+
// Output
6160
header('Content-type: image/png');
6261
imagepng($im);
63-
imagedestroy($im);
6462
?>
6563
]]>
6664
</programlisting>
@@ -103,9 +101,8 @@ $sy = imagesy($stamp);
103101
// Merge the stamp onto our photo with an opacity of 50%
104102
imagecopymerge($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp), 50);
105103
106-
// Save the image to file and free memory
104+
// Save the image to file
107105
imagepng($im, 'photo_stamp.png');
108-
imagedestroy($im);
109106
110107
?>
111108
]]>

reference/image/functions/image-type-to-extension.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ $im = imagecreatetruecolor(100, 100);
6161
6262
// Save image
6363
imagepng($im, './test' . image_type_to_extension(IMAGETYPE_PNG));
64-
imagedestroy($im);
6564
?>
6665
]]>
6766
</programlisting>

reference/image/functions/image2wbmp.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ $image = imagecreatefrompng($file);
7878
7979
header('Content-Type: ' . image_type_to_mime_type(IMAGETYPE_WBMP));
8080
image2wbmp($image); // output the stream directly
81-
imagedestroy($image);
8281
?>
8382
]]>
8483
</programlisting>

reference/image/functions/imagealphablending.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ imagefilledrectangle($im, 30, 30, 70, 70, imagecolorallocate($im, 255, 0, 0));
8686
header('Content-Type: image/png');
8787
8888
imagepng($im);
89-
imagedestroy($im);
9089
?>
9190
]]>
9291
</programlisting>

reference/image/functions/imageantialias.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ imagecopymerge($aa, $normal, 200, 0, 0, 0, 200, 100, 100);
105105
header('Content-type: image/png');
106106
107107
imagepng($aa);
108-
imagedestroy($aa);
109-
imagedestroy($normal);
110108
?>
111109
]]>
112110
</programlisting>

reference/image/functions/imagearc.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ imagearc($img, 140, 75, 50, 50, 0, 360, $blue);
143143
header("Content-type: image/png");
144144
imagepng($img);
145145
146-
// free memory
147-
imagedestroy($img);
148-
149146
?>
150147
]]>
151148
</programlisting>

reference/image/functions/imagebmp.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ imagestring($im, 1, 5, 5, 'BMP with PHP', $text_color);
9696
9797
// Save the image
9898
imagebmp($im, 'php.bmp');
99-
100-
// Free up memory
101-
imagedestroy($im);
10299
?>
103100
]]>
104101
</programlisting>

reference/image/functions/imagecolorallocatealpha.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ header('Content-Type: image/png');
124124
125125
// and finally, output the result
126126
imagepng($image);
127-
imagedestroy($image);
128127
?>
129128
]]>
130129
</programlisting>

reference/image/functions/imagecolorclosest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ foreach($colors as $id => $rgb)
108108
109109
echo "#$id: Search ($rgb[0], $rgb[1], $rgb[2]); Closest match: $result.\n";
110110
}
111-
112-
imagedestroy($im);
113111
?>
114112
]]>
115113
</programlisting>

reference/image/functions/imagecolorclosestalpha.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ foreach($colors as $id => $rgb)
9595
9696
echo "#$id: Search ($rgb[0], $rgb[1], $rgb[2], $rgb[3]); Closest match: $result.\n";
9797
}
98-
99-
imagedestroy($im);
10098
?>
10199
]]>
102100
</programlisting>

0 commit comments

Comments
 (0)