Welcome Guest, Not a member yet? Register   Sign In
image_lib bug?
#1

[eluser]smith[/eluser]
I am trying to solve this problem all night but no luck:

Code:
//database connection, pulling the picture from the database
foreach ($query->result() as $row)
{
    $this->data['sid']       = $row->sid;
    $this->data['aid']       = $row->aid;
    $this->data['filename']  = $row->filename;
    $this->data['filetype']  = $row->filetype;
    $this->data['filesize']  = $row->filesize;
    $this->data['picture']     = $row->picture;
}

//temp file
$tmpfname  = tempnam("/tmp", "test_");

//putting the picture into a temp file
write_file($tmpfname, $this->data['picture']);

//resize config:
$config['source_image']   = $tmpfname;
$config['new_image']      = '/tmp/test';
$config['maintain_ratio'] = TRUE;
$config['dynamic_output'] = FALSE;
$config['width']          = 120;
$config['height']         = 120;

$this->load->library('image_lib');
$this->image_lib->initialize($config);
$this->image_lib->resize();
echo $this->image_lib->display_errors();

If i use dynamic output it works but i don't know what is wrong with new_image config option.

1. If $config['new_image'] = '/tmp/test'; file is not created inside tmp dir, i can't find the file
2. If $config['new_image'] = 'test'; file is created inside tmp dir, i think because the original file is in tmp dir (RTFM says so), but the file name begins with a dot and it is called .test
3. If no new_image is used new file is created, same name as the original, but with a dot: /tmp/.original_file_name, in my case $tmpfname

Is this a bug or a feature? Because the problem can be solved by moving ".original_file_name" to "original_file_name". But if it is a bug i can't take that additional step...

system: centos 5
php: 5.1.6
gd: 2.0.28 bundled (installed from yum repository)


Messages In This Thread
image_lib bug? - by El Forum - 08-02-2007, 01:23 AM
image_lib bug? - by El Forum - 08-02-2007, 02:50 AM
image_lib bug? - by El Forum - 08-02-2007, 03:01 AM
image_lib bug? - by El Forum - 08-02-2007, 05:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB