Welcome Guest, Not a member yet? Register   Sign In
Image manipulation not working on localhost
#11

[eluser]dsheetz[/eluser]
That didn't help. I don't get any errors, or any output, with dynamic output on/off and any of the image libraries.

Does this code need to go in the controller or something? Right now I have it in my view file.
#12

[eluser]dsheetz[/eluser]
This is curious... the following code:

---

Code:
$filename = "photo1.jpg";
$config['image_library'] = 'gd';
$config['source_image']    = PHOTOS_DIR . $filename;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;
$config['dynamic_output'] = TRUE;

$this->load->library('image_lib', $config);

echo "<pre>";
print_r($config);
echo "</pre>";

echo "<pre>";
print_r($this->image_lib);
echo "</pre>";

if (!$this->image_lib->resize())
{
    echo $this->image_lib->display_errors();
}

Generates the following output:

Code:
Array
(
    [image_library] => gd
    [source_image] => /home/mattturl/stock_library/photo1.jpg
    [create_thumb] => 1
    [maintain_ratio] => 1
    [width] => 75
    [height] => 50
    [dynamic_output] => 1
)

ci_image_lib Object
(
    [image_library] => gd2
    [library_path] =>
    [dynamic_output] =>
    [source_image] =>
    [new_image] =>
    [width] =>
    [height] =>
    [quality] => 90
    [create_thumb] =>
    [thumb_marker] => _thumb
    [maintain_ratio] => 1
    [master_dim] => auto
    [rotation_angle] =>
    [x_axis] =>
    [y_axis] =>
    [wm_text] =>
    [wm_type] => text
    [wm_x_transp] => 4
    [wm_y_transp] => 4
    [wm_overlay_path] =>
    [wm_font_path] =>
    [wm_font_size] => 17
    [wm_vrt_alignment] => B
    [wm_hor_alignment] => C
    [wm_padding] => 0
    [wm_hor_offset] => 0
    [wm_vrt_offset] => 0
    [wm_font_color] => #ffffff
    [wm_shadow_color] =>
    [wm_shadow_distance] => 2
    [wm_opacity] => 50
    [source_folder] =>
    [dest_folder] =>
    [mime_type] =>
    [orig_width] =>
    [orig_height] =>
    [image_type] =>
    [size_str] =>
    [full_src_path] =>
    [full_dst_path] =>
    [create_fnc] => imagecreatetruecolor
    [copy_fnc] => imagecopyresampled
    [error_msg] => Array
        (
        )

    [wm_use_drop_shadow] =>
    [wm_use_truetype] =>
)

Notice how the image library is different for the $config array vs. the image_lib object... could this be indicative of a configuration error?
#13

[eluser]dsheetz[/eluser]
by the way, there should be opening PRE tags in each of the initial echo statements... the forum seems to have escaped those somehow.

Edit: fixed the above post to quote code properly.
#14

[eluser]IkoTikashi[/eluser]
[quote author="dsheetz" date="1233287929"]That didn't help. I don't get any errors, or any output, with dynamic output on/off and any of the image libraries.

Does this code need to go in the controller or something? Right now I have it in my view file.[/quote]
Jupp, the code should go into the controller, I have it in the welcome.php controller in the "function index()".
#15

[eluser]IkoTikashi[/eluser]
[quote author="dsheetz" date="1233288714"]Notice how the image library is different for the $config array vs. the image_lib object... could this be indicative of a configuration error?[/quote]Hm strange, do you "autoload" the image_lib in config/autoload.php? Do you load it somewhere else? Here's my main controller:
Code:
&lt;?php
class Main extends Controller
{
    function Main()
    {
        parent::Controller();
    }

    function index()
    {
        $config['image_library'] = 'gd2';
        $config['source_image'] = "/cvswebs/test/foto.jpg";
        $config['create_thumb'] = TRUE;
        $config['maintain_ratio'] = TRUE;
        $config['width'] = 75;
        $config['height'] = 50;
        #$config['dynamic_output'] = TRUE;

        $this->load->library('image_lib', $config);

        echo "<pre>";
        print_r($config);
        echo "</pre>";

        echo "<pre>";
        print_r($this->image_lib);
        echo "</pre>";

        if (!$this->image_lib->resize())
        {
            echo $this->image_lib->display_errors();
        }
    }
}
which prints everything just fine and produces a thumbnail of the image. This is in a drop-in standard installation of CI. (I'm on PHP5 btw)
#16

[eluser]neosable[/eluser]
I had the same problem I removed the image_lib from autoload and now works - this must be a bug
#17

[eluser]hamzakhan[/eluser]
&lt;?php
/**
*
*
*/
class Image extends Controller {

function Image()
{
parent::Controller();
}

function index()
{
$this->load->library('image_lib');
$config['image_library'] = 'gd2';
$config['source_image'] = '/server/sscart/assets/images/catagory/mypic.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 25;
$config['height'] = 25;
$config['dynamic_output'] = TRUE;



// print "<img src='/server/sscart/assets/images/catagory/mypic.jpg'>";

if ( ! $this->image_lib->resize())
{
echo $this->image_lib->display_errors();
}

print "<pre>";
print_r($config);
print_r($this->image_lib);
}
}
?&gt;

botheration is the first rule of codeigneter
you cannot get your solution untill unless u bother
so please tell me i am bother for long time.fed up from this rubish topic.
not able to resize a simple image.
code is above

my root dir of codeigneter is /server/sscart/
assest folder is /server/sscart/assets/images/catagory/mypic.jpg

library is loaded evey thing is working fine then what is goin wrong.
#18

[eluser]IkoTikashi[/eluser]
@hamzakhan:

It could that you need to load the lib after defining the configs, not before:

$this->load->library('image_lib', $config);
#19

[eluser]hamzakhan[/eluser]
IkoTikashi
thanks for the answer my problem is now solved last night.
but still thanks for your time.




Theme © iAndrew 2016 - Forum software by © MyBB