-1

我正在尝试调整从服务器上某个位置获取的图像的大小。

CI 图像处理方法效果很好。但我需要这样的东西

localhost/images/hello.jpg -width=500&height=450

或者

localhost/images/imageresizer?path=http://localhost/images/hello.png&width=500&height=450

我知道第一个看起来很奇怪,但我只想知道除了 CI 中的 image_lib 之外是否还有其他好的方法

使用 Ci image_lib 图像只是显示在浏览器上,而不是显示它,我需要将 url 输出到 json 中的图像。以便前端开发人员可以在他们的设备上显示它们

请建议

谢谢你。

4

2 回答 2

1

Try this out Codeigniter Advanced Images. It has worked perfectly for me. You only have to note that the uploads folder has to be in the same location as the index.php page. Also, the folder name and controller name have to be the same. Cheers.

于 2015-04-28T11:40:07.567 回答
0
function resize($path="", $width="", $height="", $type=""){
    if($path AND $width AND $height AND $type){
        $decoded_path = base64_decode($path);
        //resize
        header("Content-type:image/$type");
        echo $image;
    }
}

--

$image_path = "/var/www/images/test.png";

<img src="<?php echo "http://example.com/app/resize/" . base64_encode($image_path) . "/500/200/png"; ?>" alt="my resized image">
于 2014-02-19T15:29:19.773 回答