Welcome Guest, Not a member yet? Register   Sign In
image resize library issues
#4

[eluser]steward[/eluser]
Processing photos in a loop:
Took me longer than I wanted.

Docs are missing an entry for image_lib->initialize(), and that is the key.

The information is there, but you have to read the page slowly and carefully, like a gripping novel. I prefer griping. Which is not novel.

Just in case another has the same issue, here is what worked for me:

load lib
begin loop
clear
set options
initialize
invoke method
end loop

Code:
// resize all pics in a folder (replace existing). We want a max size of 10K per thumb
    function rethumb()
    {
        $picpath = $this->config->item('base_dir') . '/my/file/videos/image';
        $this->load->library('image_lib');
        $aFiles=$this->get_files($picpath);
        foreach($aFiles AS $fn)
        {
                $fn = $picpath . $fn;
                $filesize = filesize($fn);
                if ( ($filesize >0) AND ($filesize < 10240) )
                {
                  continue;
                }
                echo "<BR>$fn";
                $this->image_lib->clear();
                $config['image_library']    = 'gd';
                $config['create_thumb']        = TRUE;
                $config['maintain_ratio']    = TRUE;
                $config['width']                    = 150;
                $config['height']                    = 150;
                $config['master_dim']            = 'width';
                $config['thumb_marker']        = '';
                $config['source_image']        = $fn;
                $this->image_lib->initialize($config);
                if ( ! $this->image_lib->resize() )
                {
                     echo '<BR><B>' . $this->image_lib->display_errors() . '</B>';
                }
        }
     }

PS: If you are using phpFox, take a look at your video image folder. Some of them thumbnails are .5MB !


Messages In This Thread
image resize library issues - by El Forum - 03-21-2009, 08:52 AM
image resize library issues - by El Forum - 03-21-2009, 09:00 AM
image resize library issues - by El Forum - 03-21-2009, 09:05 AM
image resize library issues - by El Forum - 03-23-2009, 02:00 PM
image resize library issues - by El Forum - 03-29-2009, 06:06 PM
image resize library issues - by El Forum - 03-29-2009, 06:26 PM
image resize library issues - by El Forum - 03-30-2009, 07:17 AM
image resize library issues - by El Forum - 03-30-2009, 07:23 AM
image resize library issues - by El Forum - 03-30-2009, 07:43 AM
image resize library issues - by El Forum - 03-30-2009, 08:05 AM
image resize library issues - by El Forum - 03-31-2009, 05:40 PM
image resize library issues - by El Forum - 03-31-2009, 05:45 PM
image resize library issues - by El Forum - 03-31-2009, 06:00 PM
image resize library issues - by El Forum - 03-31-2009, 06:23 PM
image resize library issues - by El Forum - 03-31-2009, 07:00 PM
image resize library issues - by El Forum - 04-02-2009, 07:30 AM
image resize library issues - by El Forum - 04-02-2009, 08:18 AM
image resize library issues - by El Forum - 03-23-2010, 06:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB