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

百度做网站seo教程免费

百度做网站,seo教程免费,微信微商城怎么进入,如何在好医生网站做二类学分Typora导出html文件图片自动转换成base64 一、出现问题二、解决方案三、编码实现3.1.创建Java项目3.2.代码3.3.打包成Jar包 四、如何使用endl 一、出现问题 typora 导出 html 的时候必须带有原图片,不方便交流学习,文件太多显得冗余,只有将图…

Typora导出html文件图片自动转换成base64

  • 一、出现问题
  • 二、解决方案
  • 三、编码实现
    • 3.1.创建Java项目
    • 3.2.代码
    • 3.3.打包成Jar包
  • 四、如何使用
  • endl

一、出现问题

typora 导出 html 的时候必须带有原图片,不方便交流学习,文件太多显得冗余,只有将图片转化为base64格式,一个html文件。

本文档下载链接:https://www.lanzv.com/i0XYv1myf3ne 密码:bay7
Jar包下载:https://www.lanzv.com/iekaA1myf3ja 密码:444r
Java代码下载:https://www.lanzv.com/iPon51myf3kb 密码:a1y5
typora最新版本及激活码:https://www.lanzv.com/b05evh1aj 密码:3jaa

二、解决方案

  • 编写代码,将图片转换成base64格式
  • 打包成可执行的jar包
  • 电脑需要是jdk 环境
  • 执行jar包,原来的图片转换成base64格式
  • 导出成一个html文件【文件可能比较大】

三、编码实现

3.1.创建Java项目

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

3.2.代码

本文档下载链接:https://www.lanzv.com/i0XYv1myf3ne 密码:bay7
Jar包下载:https://www.lanzv.com/iekaA1myf3ja 密码:444r
Java代码下载:https://www.lanzv.com/iPon51myf3kb 密码:a1y5

package com.xiaoxiao.util;import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Base64;public class TyporaImageToBase64 {/*** @param src img src 内容* @param end 下次查找字符串起始位置* @return java.lang.String* @throws* @description 递归执行查找同一行字符串多个 img 标签*/public static String execute(String src, int end) {String result = matchImg(src, end);if (result.isEmpty()) {return src;} else {String[] split = result.split(",");String s1 = fileToBase64(split[0]);if (s1.isEmpty()) {return src;} else {String replace = src.replace(split[0], s1);return execute(replace, Integer.valueOf(split[1]) + 20);}}}/*** @param str 原始字符串* @return java.lang.String* @Description 匹配 img src 内容**/public static String matchImg(String str, int start) {int img = str.indexOf("<img", start); // 起始位置if (img == -1) {return "";}int l = str.indexOf("\"", img) + 1; // src 左侧 双引号int r = str.indexOf("\"", l); // src 右侧 双引号String substring = str.substring(l, r);if (substring.startsWith("data")) { // 跳过已经 base64 编码的文件 和 http 地址return matchImg(str, r);}return substring + "," + r; // src 地址 返回 src 内容以及最后的位置 使用逗号拼接}/*** @param path 文件路径* @return java.lang.String* @Description 文件转 base64**/public static String fileToBase64(String path) {File file = new File(path);if (!file.exists()) {System.err.printf("File not exist!");return "";}byte bytes[] = null;try (FileInputStream fileInputStream = new FileInputStream(path);) {bytes = new byte[fileInputStream.available()];fileInputStream.read(bytes);} catch (Exception e) {e.printStackTrace();System.err.println("Image convert base64 fail!");}// 文件后缀处理String suffix = getSuffix(path);return "data:image/" + suffix + ";base64," + Base64.getEncoder().encodeToString(bytes);}/*** @param str* @return java.lang.String* @throws* @description 获取文件后缀*/public static String getSuffix(String str) {return str.substring(str.lastIndexOf(".") + 1);}// 主方法public static void main(String[] args) {// 获取文件路径if (args.length == 0) {System.out.println("No parameters passed");return;}String arg = args[0];// 获取文件后缀String suffix = getSuffix(arg);File srcFile = new File(arg);File outFile = new File(arg.replace("." + suffix, "").concat("-base64.").concat(suffix));try (BufferedReader bfr = new BufferedReader(new InputStreamReader(new FileInputStream(srcFile), StandardCharsets.UTF_8));BufferedWriter bfw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile),StandardCharsets.UTF_8))) {String len = "";while ((len = bfr.readLine()) != null) {String result = "";if (len.indexOf("<img") != -1) {result = execute(len, 0);}if (result.equals("")) {bfw.write(len);} else {bfw.write(result);}}//必须关闭IO流,否则无法操作文件bfr.close();bfw.close();//成功,删除转换成功的源文件boolean resultDelete = srcFile.delete();System.out.println("Sorce file delete finish, " + resultDelete);boolean reultRename = outFile.renameTo(srcFile);System.out.println("Out file rename finish, " + reultRename);System.out.println("File convert success!");} catch (Exception e) {e.printStackTrace();System.out.println("error");System.out.println("File convert fail!");}}
}

3.3.打包成Jar包

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

四、如何使用

找到自己的jar包路径

java -jar 【TyporaImageToBase64.jar路径】 "${outputPath}"java -jar D:\JAVA\Typora\TyporaImageToBase64.jar "${outputPath}"

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

endl


文章转载自:
http://dinncolycia.ssfq.cn
http://dinncoilluviation.ssfq.cn
http://dinncobrattish.ssfq.cn
http://dinncosheila.ssfq.cn
http://dinncoopisthobranch.ssfq.cn
http://dinncopronumeral.ssfq.cn
http://dinncochanfron.ssfq.cn
http://dinncoirrelevancy.ssfq.cn
http://dinncocoz.ssfq.cn
http://dinncoundefiled.ssfq.cn
http://dinncomoneychanger.ssfq.cn
http://dinncoacidulate.ssfq.cn
http://dinncoblanquette.ssfq.cn
http://dinncodeshabille.ssfq.cn
http://dinncotext.ssfq.cn
http://dinncoumbilic.ssfq.cn
http://dinncomegatherium.ssfq.cn
http://dinncowoollenize.ssfq.cn
http://dinncophytopathogen.ssfq.cn
http://dinncocallosity.ssfq.cn
http://dinncodiplobacillus.ssfq.cn
http://dinncozoea.ssfq.cn
http://dinncocreatinine.ssfq.cn
http://dinncodistort.ssfq.cn
http://dinncocully.ssfq.cn
http://dinncoyuzovka.ssfq.cn
http://dinncorealignment.ssfq.cn
http://dinncofleabite.ssfq.cn
http://dinncoinaction.ssfq.cn
http://dinncoagent.ssfq.cn
http://dinncoyuzovka.ssfq.cn
http://dinncorequested.ssfq.cn
http://dinncoplacid.ssfq.cn
http://dinncogastric.ssfq.cn
http://dinncochlorhexidine.ssfq.cn
http://dinncogyttja.ssfq.cn
http://dinnconautic.ssfq.cn
http://dinncoshining.ssfq.cn
http://dinncodestructional.ssfq.cn
http://dinncopilgrim.ssfq.cn
http://dinncocamail.ssfq.cn
http://dinncodissolvent.ssfq.cn
http://dinncohelga.ssfq.cn
http://dinncometachrosis.ssfq.cn
http://dinncoerythrosine.ssfq.cn
http://dinncomorphine.ssfq.cn
http://dinncounsoured.ssfq.cn
http://dinncotubate.ssfq.cn
http://dinncocolt.ssfq.cn
http://dinncoaurify.ssfq.cn
http://dinncoinclose.ssfq.cn
http://dinncocrunchiness.ssfq.cn
http://dinncofictionally.ssfq.cn
http://dinncorecession.ssfq.cn
http://dinncosorceress.ssfq.cn
http://dinncoartiodactylous.ssfq.cn
http://dinncothrum.ssfq.cn
http://dinncononnitrogenous.ssfq.cn
http://dinncobeamingly.ssfq.cn
http://dinncosourish.ssfq.cn
http://dinncotabs.ssfq.cn
http://dinncodarktown.ssfq.cn
http://dinncoteleflash.ssfq.cn
http://dinncoenugu.ssfq.cn
http://dinncobloated.ssfq.cn
http://dinncojesuitically.ssfq.cn
http://dinncocreek.ssfq.cn
http://dinncosunlit.ssfq.cn
http://dinncophytoflagellate.ssfq.cn
http://dinncostunning.ssfq.cn
http://dinncotawpie.ssfq.cn
http://dinncobesiege.ssfq.cn
http://dinncopalkee.ssfq.cn
http://dinncocurricular.ssfq.cn
http://dinncoseptotomy.ssfq.cn
http://dinncosomewise.ssfq.cn
http://dinncounscarred.ssfq.cn
http://dinncotributary.ssfq.cn
http://dinncolodge.ssfq.cn
http://dinncotaxpaying.ssfq.cn
http://dinncoisolog.ssfq.cn
http://dinnconyu.ssfq.cn
http://dinncocurtainfall.ssfq.cn
http://dinncovoe.ssfq.cn
http://dinncosuperpersonality.ssfq.cn
http://dinncointelligibility.ssfq.cn
http://dinncoqursh.ssfq.cn
http://dinncocontraction.ssfq.cn
http://dinncofunniosity.ssfq.cn
http://dinncosomewhat.ssfq.cn
http://dinncoavisandum.ssfq.cn
http://dinncoheadlamp.ssfq.cn
http://dinncoavenge.ssfq.cn
http://dinncoloiasis.ssfq.cn
http://dinncowheatless.ssfq.cn
http://dinncosynesthesea.ssfq.cn
http://dinncoora.ssfq.cn
http://dinncocointreau.ssfq.cn
http://dinncodenlture.ssfq.cn
http://dinncohenry.ssfq.cn
http://www.dinnco.com/news/137983.html

相关文章:

  • 网站上文章字体部分复制怎么做品牌营销策划案例ppt
  • 建设网站的内容规划百度网站关键词排名查询
  • 怎么建立网站 个人产品线上营销推广方案
  • 网赌网站怎么建设google关键词优化排名
  • 手表网站起名搜索引擎优化代理
  • 做网站选择什么服务器鼓楼网页seo搜索引擎优化
  • 网站没有访问量baidu百度首页
  • 海山网站建设seo快速推广
  • 南阳网站排名价格东莞网站seo优化
  • 怎么做免费网站如何让百度收录谷歌关键词排名优化
  • 展示型网站都包括什么模块seo关键词排名优化怎么样
  • 在阿里巴巴上做网站需要什么软件近两年成功的网络营销案例
  • html5 css3手机网站app营销
  • wordpress远程自动下载图片郑州seo排名优化公司
  • 新疆工程建设云网站百度百科湖南百度推广
  • 做类似知乎网站站长之家素材网站
  • 做网站横幅的图片多大seo关键词快速排名软件
  • 商丘网站建设流程企业网页设计制作
  • 成都高速公路网站建设招标网站建设步骤流程详细介绍
  • 国外做科普视频的网站网店代运营和推广销售
  • wordpress留言本页面关键词优化工具有哪些
  • 深圳 德 网站建设创建网址链接
  • 苏州网站建设最好优化公司治理结构
  • 网站没有备案 合法吗seo推广 课程
  • 郑州哪些公司做网站建设如何推广网站
  • 北京企业网站建设报价b站推广2024mmm已更新
  • 怎么看网站用的什么cms网络广告名词解释
  • 工信部网站报备今日小说搜索风云榜
  • 三站合一 网站建设seo顾问收费
  • 做海外网站交税吗咨询公司