PHP-CSL V0.9

 +PHP
+ Arrays (4)
+ COM for Windows (2)
+ Image (2)
+ Image Support
+ Load Image
+ LDAP (3)
+ MySQL (10)
+ Regular Expressions (2)
+ String Manipulation (11)
+ Time and Date (6)
 +Snippet Options
+   Printer Friendly
 +Library Options
+   View Other Library
 +General Options
+   Library Home
+   PHP-CSL Credits
+   PHP-CSL License
+   Resource Links
+   Log in
Syntax for: Image / Load Image

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:

<?php

/* Note: Gif only available with GD Lib ver < 1.6 */
function LoadGif ($imgname) {
    
$im = @imagecreatefromgif ($imgname); /* Attempt to open */
    
if (!$im) { /* See if it failed */
        
$im imagecreate (15030); /* Create a blank image */
        
$bgc imagecolorallocate ($im255255255);
        
$tc imagecolorallocate ($im000);
        
imagefilledrectangle ($im0015030$bgc);
        
/* Output an errmsg */
        
imagestring ($im155"Error loading $imgname"$tc);
    }
    return 
$im;
}

function 
LoadJpeg ($imgname) {
    
$im = @imagecreatefromjpeg ($imgname); /* Attempt to open */
    
if (!$im) { /* See if it failed */
        
$im  imagecreate (15030); /* Create a blank image */
        
$bgc imagecolorallocate ($im255255255);
        
$tc  imagecolorallocate ($im000);
        
imagefilledrectangle ($im0015030$bgc);
        
/* Output an errmsg */
        
imagestring ($im155"Error loading $imgname"$tc);
    }
    return 
$im;
}

function 
LoadPNG ($imgname) {
    
$im = @imagecreatefrompng ($imgname); /* Attempt to open */
    
if (!$im) { /* See if it failed */
        
$im  imagecreate (15030); /* Create a blank image */
        
$bgc imagecolorallocate ($im255255255);
        
$tc  imagecolorallocate ($im000);
        
imagefilledrectangle ($im0015030$bgc);
        
/* Output an errmsg */
        
imagestring ($im155"Error loading $imgname"$tc);
    }
    return 
$im;
}

/* Note: Gif only available with GD Lib ver >= 1.8 */
function LoadWBMP ($imgname) {
    
$im = @imagecreatefromwbmp ($imgname); /* Attempt to open */
    
if (!$im) { /* See if it failed */
        
$im  imagecreate (2020); /* Create a blank image */
        
$bgc imagecolorallocate ($im255255255);
        
$tc  imagecolorallocate ($im000);
        
imagefilledrectangle ($im001010$bgc);
        
/* Output an errmsg */
        
imagestring ($im155"Error loading $imgname"$tc);
    }
    return 
$im;
}
?>
 
Description for: Image / Load&nbsp;Image
  Loading Images of type GIF,JPEG,PNG and BMP


 
Powered by: PHP-CSL V0.9