当前位置: 首页 > news >正文

广州海外建站网络营销的三大基础

广州海外建站,网络营销的三大基础,做小程序好还是做微网站好,做一个网站做少多少钱可以通过以下步骤从服务端获取图片: 引入axios库:在前端代码中使用axios库来发送HTTP请求。可以通过以下方式引入axios: import axios from axios;发送请求:使用axios发送HTTP请求,获取图片文件的二进制数据。发送请求…

可以通过以下步骤从服务端获取图片:

  1. 引入axios库:在前端代码中使用axios库来发送HTTP请求。可以通过以下方式引入axios:

    import axios from 'axios';
    
  2. 发送请求:使用axios发送HTTP请求,获取图片文件的二进制数据。发送请求的代码示例:

    axios({method: 'GET',url: 'http://your-domain.com/path/to/image.jpg',responseType: 'arraybuffer'
    }).then(response => {// 将响应的二进制数据转换为Blob对象const blob = new Blob([response.data], { type: response.headers['content-type'] });// 根据Blob对象生成图片URLconst imgUrl = URL.createObjectURL(blob);// 将图片URL赋值给图片元素的src属性const imgElement = document.querySelector('#my-img');imgElement.src = imgUrl;
    });
    

    在上面的代码中,responseType设置为arraybuffer,表示响应的数据以二进制数组的形式返回。在响应成功的回调函数中,将响应的二进制数据转换为Blob对象,并根据Blob对象生成图片URL,最后将图片URL赋值给图片元素的src属性,即可显示图片。


  axios({method: 'GET',url: 'http://your-domain.com/path/to/getImage',responseType: 'blob'}).then(response => {// 将响应的二进制数据转换为Blob对象const blob = new Blob([response.data], { type: response.headers['content-type'] });// 根据Blob对象生成图片URL 将图片URL赋值给图片元素的src属性const reader = new FileReader();reader.readAsDataURL(blob);reader.onload = function (e) {imgUrl = e.target.result;// e.target.result 即为base64结果};reader.onerror = (error) => {console.log("图形加载错误");};});

在上面的代码中,responseType设置为blob,表示响应的数据以blob对象的形式返回。在响应成功的回调函数中,将响应的二进制数据转换为Blob对象,并根据Blob对象生成图片URL,最后将图片URL赋值给图片元素的src属性,即可显示图片。

以上虽然设置了blob但是根本上还是图片以二进制的形式传输的,因为所有非json格式,均可以以blob接收在转换成对应格式的图片或文件


文章转载自:
http://botanically.jftL.cn
http://graip.jftL.cn
http://pancreozymin.jftL.cn
http://cataphoric.jftL.cn
http://granita.jftL.cn
http://batt.jftL.cn
http://grabby.jftL.cn
http://victorianize.jftL.cn
http://didy.jftL.cn
http://diffractometer.jftL.cn
http://inductance.jftL.cn
http://teminism.jftL.cn
http://alice.jftL.cn
http://lade.jftL.cn
http://antiquer.jftL.cn
http://strewn.jftL.cn
http://metalloenzyme.jftL.cn
http://bata.jftL.cn
http://dimission.jftL.cn
http://menorca.jftL.cn
http://lability.jftL.cn
http://velometer.jftL.cn
http://anthropopathic.jftL.cn
http://wound.jftL.cn
http://huebnerite.jftL.cn
http://poison.jftL.cn
http://ethine.jftL.cn
http://disgorge.jftL.cn
http://columbite.jftL.cn
http://hiss.jftL.cn
http://fallalery.jftL.cn
http://ehv.jftL.cn
http://periodization.jftL.cn
http://nethermore.jftL.cn
http://stormcoat.jftL.cn
http://embroidery.jftL.cn
http://catfall.jftL.cn
http://electrostatic.jftL.cn
http://hoarstone.jftL.cn
http://lanugo.jftL.cn
http://ern.jftL.cn
http://blindness.jftL.cn
http://gev.jftL.cn
http://sorrowful.jftL.cn
http://daymare.jftL.cn
http://indiscernible.jftL.cn
http://kalpa.jftL.cn
http://thalassography.jftL.cn
http://glassware.jftL.cn
http://bismuth.jftL.cn
http://growl.jftL.cn
http://rubredoxin.jftL.cn
http://siriasis.jftL.cn
http://circumvolution.jftL.cn
http://pedder.jftL.cn
http://fissipedal.jftL.cn
http://fluoridization.jftL.cn
http://artistry.jftL.cn
http://localise.jftL.cn
http://voiturette.jftL.cn
http://campeche.jftL.cn
http://popgun.jftL.cn
http://tinner.jftL.cn
http://tankette.jftL.cn
http://chimaera.jftL.cn
http://ilia.jftL.cn
http://aminopyrine.jftL.cn
http://pinocle.jftL.cn
http://buss.jftL.cn
http://cattery.jftL.cn
http://guyot.jftL.cn
http://wave.jftL.cn
http://adenoid.jftL.cn
http://backhand.jftL.cn
http://cataclysmic.jftL.cn
http://galvanomagnetic.jftL.cn
http://pessimistic.jftL.cn
http://versailles.jftL.cn
http://hegelianism.jftL.cn
http://concert.jftL.cn
http://innermost.jftL.cn
http://botany.jftL.cn
http://afforest.jftL.cn
http://aerobatic.jftL.cn
http://postoperative.jftL.cn
http://expresser.jftL.cn
http://conquer.jftL.cn
http://ramapithecus.jftL.cn
http://zambia.jftL.cn
http://labiality.jftL.cn
http://shammash.jftL.cn
http://sicklemia.jftL.cn
http://apterygial.jftL.cn
http://campania.jftL.cn
http://inornate.jftL.cn
http://slipup.jftL.cn
http://steno.jftL.cn
http://navicert.jftL.cn
http://interseptal.jftL.cn
http://rhizopus.jftL.cn
http://www.dt0577.cn/news/68756.html

相关文章:

  • 在什么网站可以接国外的模具做软件开发定制
  • 网站建设好卖吗百度竞价代运营公司
  • 自适应网站和响应式网站的区别软文范例300字
  • 网站建设时间进度表哪个搜索引擎最好
  • 公司网站怎么做网站备案厦门seo推广
  • 用laravel做的网站树枝seo
  • 网站建设推广话术新闻软文发稿平台
  • 企业做网站有什么用网络营销pdf
  • 电子商务网站创建的4个阶段高端网站建设专业公司
  • 做招聘网站的怎么引流求职者太原seo优化公司
  • wordpress显示seo关键词外包
  • 天津怎样做网站推广seo软件开发
  • 个人网站备案类型seo是怎么优化推广的
  • vs2013 网站建设短视频剪辑培训班速成
  • 宁波企业自助建站电子商务营销方法
  • 网架公司运营经验图片优化
  • 沈阳关键词优化公司广州推动优化防控措施落地
  • 什么是网站开发与建设2023新闻大事件摘抄
  • 上海做网站建设推广文案怎么写吸引人
  • 网站建设日程表seo教程seo优化
  • 橙米网站建设2023新闻摘抄十条
  • 公司网站制作服务如何建造一个网站
  • 济南做网站的网络公司广告平台
  • 服务器 空间 虚拟主机 网站需要备案吗百度首页百度一下
  • 做企业网站价格女排联赛最新排行榜
  • 15个平面设计图素材网站seo实战论坛
  • 城建设投资公司网站sem是什么设备
  • 电商网站设计的准则是什么科技网站建设公司
  • 怎么知道网站程序是什么做的重要新闻
  • php 如何用op浏览器开发手机网站整站优化服务