[eluser]jedre[/eluser]
Do you use a resize method from image_lib? Can you show me resizePicture method?
What is wrong on my code?
in my constructor:
Code:
$this->imgmanrules = array(
'image_library' => 'GD2',
'maintain_ratio' => TRUE,
'width' => 500,
'height' => 500,
'quality' => 85,
'master_dim' => 'width',
);
$this->load->library('image_lib');
code to resize image:
Code:
function _img()
{
//operacje na wgranym pliku
$fileInfo = $this->upload->data();
$this->saveData['nazwa'] = $fileInfo['file_name'];
$this->imgmanrules['source_image'] = $fileInfo['full_path']; //pobieranie sciezki do pliku
$width = getimagesize($fileInfo['full_path']);
if($width[0] > $this->imgmanrules['width'] || $width[1] > $this->imgmanrules['height'])
{
//skalowanie obrazka
$this->image_lib->initialize($this->imgmanrules);
$this->image_lib->resize();
$this->image_lib->clear();
}
$imgx = array(
'image_library' => 'GD2',
'maintain_ratio' => TRUE,
'create_thumb' => TRUE,
'width' => 100,
'height' => 100,
'quality' => 85,
'master_dim' => 'width',
'source_image' => $fileInfo['full_path']
);
//tworzenie miniatur
$this->image_lib->initialize($imgx);
$this->image_lib->resize();
}
This code doesn't work how I write in first post :/
When image is smaller then 500x500px all is ok.
But when file is larger then 500x500 I take only one file with original name but size is thumbnail.
What is wrong?!