Hello guru's, I try to draw multiple rectangle using numbers from a database in php.
But all I get is an empty imagefield.
The problem is that the numbers from the database are bigger then the actual is going to be, so they need to be smaller.

I used the following code to do this:
PHP Code:
<?
    $query 
$db -> prepare("select alpb_box_id, alpb_style::lvarchar as STYLESHEET  from ao_link_page_boxes WHERE  alpb_li_id = 755 AND alpb_lngcode = '031' AND alpb_pageno = 1"); 
    
$query -> execute();
    
$result = array();
    while(
$row $query->fetch(PDO::FETCH_ASSOC)) {
        
$result[] = $row;
    }
    
$new_styles = array();
    
$styles_to_collect = array('left''top''width''height''type');
    foreach(
$result as $r)
    {
        
$new_entry = array();
        foreach(
$styles_to_collect as $stc)
        {
                
preg_match('/[\s]\s*'.$stc.':\s*([\d]+)/'$r['STYLESHEET'], $matches);
                
$new_entry[$stc] = $matches[1];
        }
        if (
substr($r['ALPB_BOX_ID'],0,3)== 'IMG') {
            
$new_entry['type'] = 'purple';
        } else {
            
$new_entry['type'] = 'green';
        }
        
$new_styles[$r['ALPB_BOX_ID']] = $new_entry;
    }
    
$db null;

    
$arr $new_styles;
foreach (
$arr as $value) {
    
    
$left $value['left'] / 11;
    
$top $value['top'] / 11;
    
$width $value['width'] / 11;
    
$height $value['height'] / 11;
    
$color $value['type'];
    
    
$drawArea ImageCreate(73,103);

    
$white ImageColorAllocate ($drawArea255255255);
    
$green ImageColorAllocate ($drawArea01280);
    
$purple ImageColorAllocate ($drawArea1280128);
    
    
ImageFilledRectangle($drawArea$left$top$width$height$color);
                
    }
    
header("Content-type: image/png");
    
ImagePNG($drawArea);
?>
The top, left, width, height are css numbers that is used to create the rectangles.

Hope someone can help me with this
Thanks