【问题标题】:What could be the possible issue with this library?这个库可能有什么问题?
【发布时间】:2013-03-24 03:24:03
【问题描述】:

我在 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


    【解决方案1】:

    尝试加载和使用小写的库。

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

    检查这个类似的问题codeigniter cannot load library

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-06
      • 1970-01-01
      相关资源
      最近更新 更多