0

我在 codeigniter 中创建了一个库。它不工作。

我的图书馆文件是;

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 

class Image_pixelete{

function __construct()
{
    $this->ci=&get_instance();

}

public function do_pixel()
{
    $image = imagecreatefromjpeg(base_url().'photo/Penguins.jpg');
    $imagex = imagesx($image);
    $imagey = imagesy($image);

    $pixelate_y=10;
    $pixelate_x=10;
    $height=$imagey;
    $width=$imagex;
    for($y = 0;$y < $height;$y += $pixelate_y+1)
    {
        for($x = 0;$x < $width;$x += $pixelate_x+1)
        {
        // get the color for current pixel
        $rgb = imagecolorsforindex($image, imagecolorat($image, $x, $y));

        // get the closest color from palette
        $color = imagecolorclosest($image, $rgb['red'], $rgb['green'], $rgb['blue']);

        imagefilledrectangle($image, $x, $y, $x+$pixelate_x, $y+$pixelate_y, $color);   
        }
    }
}

这是我的控制器调用

public function pixel()
    {
        $this->load->library('Image_pixelete');
        $this->Image_pixelete->do_pixel();
    }

这是我的错误;

codeigniter 中的库错误

我对解决问题的确切性质感到困惑。你能复习一下吗?

4

1 回答 1

0

Try by loading and using your library with lower case.

$this->load->library('image_pixelete');
$this->image_pixelete->do_pixel();

Check this similar question codeigniter cannot load library

于 2013-03-24T03:47:29.287 回答