Sign inSign up

52334755/zimg

By 52334755

•Updated over 5 years ago

Image
1

870

52334755/zimg repository overview

⁠运行
docker run -it -d -p 4869:4869 -v /data/zimg/:/zimg/bin/img --name zimg 52334755/zimg
⁠Javascript
<template>
  <div>
    <el-upload
      action="http://localhost:4869/upload"
      :show-file-list="false"
      :http-request="uploadImg"
      :on-success="onSuccess"
      :on-error="onError"
      :on-remove="onRemove"
    >
      <el-button size="small" type="primary">选择图片</el-button>
    </el-upload>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {};
  },
  created() {},
  methods: {
    onRemove(file, fileList) {
      console.log("onRemove", file);
    },
    onSuccess(res, file) {
      console.log("onSuccess", res, file);
    },
    onError() {
      console.log("onError", arguments);
    },
    async uploadImg(f) {
      const { data: resp } = await this.$axios.post("http://localhost:4869/upload", f.file, {
        headers: { "content-type": "jpeg" },
      });
      if (resp.ret) {
        console.log("Upload success, md5:", resp.info.md5);
        console.log("http://localhost:4869/"+ resp.info.md5);
      } else {
        console.log("Upload error:", resp.error.message);
      }
    },
  },
};
</script>


Tag summary

Content type

Image

Digest

Size

162.2 MB

Last updated

over 5 years ago

docker pull 52334755/zimg