开发者

Thumbnails generated using codeigniter

Is it for me or everyone that the thumbnails generated by CI have 777 permissions ? how can I set it开发者_开发问答 to have just 644 by default ??

Thanks


in your application/configs/constants.php file you have 4 constants:

define('FILE_READ_MODE', 0644);
define('FILE_WRITE_MODE', 0666);
define('DIR_READ_MODE', 0755);
define('DIR_WRITE_MODE', 0777);

For the Image_Lib library codeigniter stores the image file using DIR_WRITE_MODE for some unknown reason.

You should double check this with the CI Guys as i believe they should be using FILE_WRITE_MODE.

you can open the library file and manually modify the sections such as

if ($this->dynamic_output === FALSE)
    {
    if ($this->orig_width == $this->width AND $this->orig_height == $this->height)
    {
        if ($this->source_image != $this->new_image)
        {
            if (@copy($this->full_src_path, $this->full_dst_path))
            {
                @chmod($this->full_dst_path, DIR_WRITE_MODE);
            }
        }
        return TRUE;
    }
}

and change the line @chmod($this->full_dst_path, DIR_WRITE_MODE); to FILE_WRITE_MODE so that it writes correctly.

there is a few sections of the file like this so you may have to search for others

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜