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

平台营销方式有哪些seo优化名词解释

平台营销方式有哪些,seo优化名词解释,网站多数关键词,网站代码组件前言:在HarmonyOS项目开发中,我们使用Ark-Ts语言开发项目。我们有个功能是拍照,除了正常显示出来,并且上传服务器。我在开发过程中,遇到的问题是,如果离开这个页面再回到当前页面仍要显示图片,那…

前言:在HarmonyOS项目开发中,我们使用Ark-Ts语言开发项目。我们有个功能是拍照,除了正常显示出来,并且上传服务器。我在开发过程中,遇到的问题是,如果离开这个页面再回到当前页面仍要显示图片,那我的思路就是存储在沙盒,重新回到这个页面先去沙盒里面查找照片,如果找到就显示出来。

流程图:

请添加图片描述

1.模拟拍照:
模拟拍照方法
takePhoto(){let pixelMap1 = await SnapshotUtil.snapshot()//添加水印信息(此处省略)//调用步骤2.//照片存储到本地,并返回路径let filePath:string = await WinPixelImageTool.asyncSavePixelImageToFileCache(waterMarkPixelMap);//存储照片存储沙盒路径let imageKey = '自定义key值'PreferencesManager.set(imageKey,filePath);}
/*** 获取窗口截图,使用Promise异步回调。* @param windowClass 不传默认截图主窗口* @returns*/static async snapshot(windowClass?: window.Window): Promise<image.PixelMap> {return (windowClass ?? AppUtil.getMainWindow()).snapshot();}
2.生成图片存储路径
static asyncSavePixelImageToFileCache(pixelIamge:PixelMap){return new Promise<string>((resolve)=>{const imagePackerApi: image.ImagePacker = image.createImagePacker();let packOpts : image.PackingOption = { format:"image/png", quality:100 };const context : Context = AppUtil.getContext();let fileName = DateUtil.getTodayTime().toString();let path : string = context.cacheDir + `/sfa`;if (!FileUtil.accessSync(path)) {FileUtil.mkdirSync(path)}path = `${path}/pixel_map_${fileName}.png`let file = fs.openSync(path, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE);imagePackerApi.packToFile(pixelIamge, file.fd, packOpts,(error: BusinessError): void => {if (error) {resolve('')}else {// let fileUriPath = fileUri.getUriFromPath(path);resolve(path)}})})}

//存储方法

static set(key: string, value: dataPreferences.ValueType) {if (context==undefined) {context = AppUtil.getContext()}let preferences = dataPreferences.getPreferencesSync(context, { name: preferencesName });preferences?.putSync(key, value);preferences?.flush();}
3.如何将图片转为PixelMap并且显示出来,方法如下:

/*

  • 沙盒目录下的照片转为image.PixelMap
  • imageId是存储照片沙盒路径的key
  • localImagePath 是照片的存储沙盒路径
    */
//通过Imagekey获取图片,比如门头照显示就是此方法static getImageByImageId(imageId:string):Promise<image.PixelMap> {return new Promise<image.PixelMap>(async (resolve,reject) => {let localImagePath =  PreferencesManager.get(imageId) as string;if (localImagePath&&localImagePath.length>0) {let tmpImagePixelMap =  await WinImagePixelMapUtils.getImagePixelMapWithFilePath(localImagePath);resolve(tmpImagePixelMap.pixelMap);}else {reject();}})}//WinImagePixelMapUtils类
static async getImagePixelMapWithFilePath(filePath:string){let imageSource = image.createImageSource(filePath);return await imageSource2PixelMap(imageSource);}export  async function imageSource2PixelMap(imageSource: image.ImageSource): Promise<ImagePixelMap> {const imageInfo: image.ImageInfo = await imageSource.getImageInfo();const height = imageInfo.size.height;const width = imageInfo.size.width;const options: image.DecodingOptions = {editable: true,desiredSize: { height, width }};const pixelMap: PixelMap = await imageSource.createPixelMap(options);const result: ImagePixelMap = { pixelMap, width, height };return result;
}

getImageByImageId
通过此方法找到沙盒里面的图片,
使用Image组件可以直接加载tmpImagePixelMap.pixelMap

http://www.dtcms.com/wzjs/422686.html

相关文章:

  • 网站开发视频是存储的排超联赛积分榜
  • 网站建设都有哪些整合营销传播方案案例
  • 两学一做 答题 网站做一个网站
  • 机械设备行业网站建设广告网站留电话不用验证码
  • 阿克苏建设租房信息阿克苏租房网站seo流量增长策略
  • 做网站需要备案国内军事新闻最新消息
  • 网站建设常见故障百度搜索引擎排行榜
  • 用苹果cms做电影网站优化关键词快速排名
  • 做的比较好的公司网站企业网站优化排名
  • mediwiki 做网站北京网站建设公司案例
  • 苏州网站建设公司鹅鹅鹅张家界百度seo
  • 黄埔网站建设bt樱桃 磁力岛
  • 网站建设相关新闻企业如何注册自己的网站
  • 昆明网站排名优化公司阿里云搜索引擎
  • wordpress 太原广州seo全网营销
  • 社交网络的推广方法有哪些seo网站建设是什么意思
  • php中做购物网站的教程百度快照是啥
  • 禁止复制的网站昆山网站建设公司
  • 微信公众号小程序网站seo优化方案项目策划书
  • wordpress网站目录竞价推广账户竞价托管收费
  • 网站系统安全保护等级是必须做的网站seo优化有哪些方面
  • 今日头条淄博新闻seo怎么优化关键词排名培训
  • 网站怎么上传网络营销工程师
  • 做网站的主流技术上海职业技能培训机构一览表
  • flash 网站 收费seo优化技巧
  • 公司网站二维码怎么做的推广自己的网站
  • 宁波优化网站厂家查网站关键词工具
  • 台州网站建设蓝渊淘宝怎么提高关键词搜索排名
  • 微信公众平台商城开发seo专业优化方法
  • 荥阳做网站网站关键词优化系统