如何使用Dropbox和Javascript将图片添加到Codepen,然后在屏幕上显示时说出的图片名称?包括的例子

如何解决如何使用Dropbox和Javascript将图片添加到Codepen,然后在屏幕上显示时说出的图片名称?包括的例子

我有一个问题,请帮助。我有一个我想创建的Codepen页面(已经部分创建,请参见下面的链接示例)已经创建,该页面选择4个随机形状并将其显示在屏幕上,一次一个,形状为Square,Triangle,Circle或Cross,以及再次单击该图片时,它将移至下一张图片,并且计算机会说出上一张图片的名称。

我想做的是从我的Dropbox帐户和一个我共享的文件夹中选择图片,然后显示在屏幕上。计算机说出图片中的单词,即Triangle图片,计算机说出Triangle。如果Dropbox不适合,请帮助我选择什么是替代品和免费软件。

我不知道我是否正确共享了Dropbox中的文件夹,我看不到在哪里找到每张图片的确切URL?或如何将图片链接到相关单词。

下面是一个示例,我得到了帮助,可以使用随机颜色进行此操作,现在想让图片做类似的事情。

我需要帮助的示例页面; https://codepen.io/3DAttic/pen/abNNxRP

创建了示例页面,其中该项目适用于随机颜色; https://codepen.io/3DAttic/pen/gOrrQzq

预先感谢 尼克又名3Dattic。

   'HTML'
  <font size=4> <body onkeydown="speakPrevious()" onkeyup="getNewRandomPicture()">

 <p> <b>This webpage is going to show 4 random pictures of shapes,Square,Cross,Triangle and Circle.
     The algorithm will select at random and <U>You MAY see the same shape several times in a row.          This is expected behavior and NOT a fault.</U>
This will work,using a computer and keyboard or on mobile device using the browser. On the mobile device touch on the text. It may help by placing your finger near the top of the webpage in the phone </p>
<p>On a computer click inside the color and press any keyboard key to move to the next shape.</b></p> 
<p> <font size=4><b><U>If the speach stops,just refresh the page again</b> </p>


   'JS'
     const page = document.querySelector("body");
      page.addEventListener("click",function () {
    speakPrevious();
    getNewRandomPicture();
});

    speakPrevious();
    function speakPrevious() {
    var synth = window.speechSynthesis;
    var utterThis = new SpeechSynthesisUtterance(window.value);
    synth.speak(utterThis);
}

   getNewRandomPicture();
   function getNewRandomPicture() {
   var myArray = ['Triangle','Square','Circle','Cross' ];
   var rand = myArray[Math.floor(Math.random() * myArray.length)]; document.getElementsByTagName("body")[0].style.backgroundColor = rand;
   var oldRand = rand;
   window.value = oldRand;
 }

解决方法

Dropbox于2017年删除了“公用文件夹”,您现在可以选择共享文件并将复制的链接复制到脚本中。

我仍然需要知道如何将其添加到我的原始问题中

,

您可以做的是使用Dropbox api,您可以在其中通过http请求访问该数据。

有几种获取图像内容的方法。其中的一些端点是:

  • filesGetThumbnailBatch

获取某些图像的缩略图。我认为这是最好的选择,因为您可以选择图像的分辨率并使其更快。

  • filesGetTemporaryLink

获取文件的4小时链接

  • 文件下载

下载文件数据

以下是API和所有端点的文档:

https://www.dropbox.com/developers/documentation/http/documentation

,

您可以做的是:

  • 通过Dropbox创建链接共享图像
  • 转到链接
  • 右键单击图像
  • 选择“在新标签页中打开图像”
  • 复制新标签的网址
  • 使用HTML的img标签的src值中的URL:>(请参见示例)

<img src="https://cdn.pixabay.com/photo/2020/05/16/16/43/book-5178205_960_720.jpg"></>

,

您可以将Dropbox用作文件托管。以下是使用它为您的应用托管图片的方法。

1-转到您的Dropbox公用文件夹。

2-将您的图像上传到此文件夹中。

3-单击图像,然后选择“复制公共链接”。

4-复制URL并将其用于图像src值。

希望它能对您有所帮助, 干杯!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-