Toon posts:

[php] functie voor type van image werkt niet

Pagina: 1
Acties:

Verwijderd

Topicstarter
en laat alle images .gif zijn :? waarom?

PHP:
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
function getPictureType($picture) {
    $imagetype = array(1 => "gif",
                       2 => "jpeg",
                       3 => "png");

    /*
    1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP,
    7 = TIFF(intel byte order), 8 = TIFF(motorola byte order,
    9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF
    */

    if (is_file($picture)) {
        $im = getimagesize($picture);
        $info['px'] = $im[0];
        $info['py'] = $im[1];
        foreach ($imagetype AS $id => $name) {
            if ($id = $im[2]) {
                $info['type'] = $name;
                break;
            }
        }
        return $info;
    }
    return false;
}


zelfs als ik .jpeg/etc bestanden upload, verder pakt ie de width, height goed :)

  • KillR-B
  • Registratie: Mei 2002
  • Laatst online: 20-01 20:49
PHP:
1
if ($id = $im[2]) {


moet zijn:

PHP:
1
if ($id == $im[2]) {

Verwijderd

Topicstarter
|:( idd dom dom dom :D