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

  Loading Images of type GIF,JPEG,PNG and BMP