简体   繁体   English

上传图片时如何发送一些额外的字段?

[英]How to send some extra fields while uploading images?

I am creating a dynamic slider. 我正在创建一个动态滑块。 Like in side admin can upload images for slider and that will be shown in front side. 就像在侧面,管理员可以为滑块上传图像,并且该图像将显示在正面。 I am uploading multiple images. 我正在上传多张图片。 All this code is ready and working successfully but my client want that: 所有这些代码已经准备就绪并且可以成功运行,但是我的客户希望这样做:

  1. While adding images he need a URL for each image must be saved in db so that when any one user click on the image(in slider) she / he should go to that saved URL for that image. 添加图像时,他需要为每个图像提供一个URL,必须将其保存在db中,以便在任何用户单击图像(在滑块中)时,她/他应转到该图像的保存URL。

  2. There should be a separate timing for each to here timing means how much time that image must be stay in slider as we know in slider all the images moving continuously. 每个时序都应有单独的时序,时序意味着图像必须在滑块中停留多少时间,正如我们在滑块中所知道的那样,所有连续移动的图像。

As I am uploading multiple images how can I set separate URL and timing for each image 当我上传多张图片时,如何为每张图片分别设置URL和时间

I need something like when I browse images (only browse not upload) there the images i browsed will me shown and under each image there will be two text boxes for key in URL and time. 我需要类似的图像,当我浏览图像(仅浏览而不上传)时,将显示我浏览的图像,并且在每个图像下方将有两个用于输入URL和时间的文本框。 This is the solution but I don't know how to do this. 这是解决方案,但我不知道该怎么做。

When you are uploading image from admin side, create 2 extra fields for image URL and Image Delay time. 从管理员端上传图片时,请为图片网址和图片延迟时间创建2个额外的字段。

And then save them into DB 然后将它们保存到数据库中

And while rendering those images onto front-end ... use your loop to generate the links along with image. 在将这些图像渲染到前端时...使用循环生成与图像一起的链接。 Something like that 像这样

foreach($images as $img){
?>
<a href="<?php echo $img['link'] ?>"> 
    <img src="<?php echo $img['img_url'] ?>" />    
 </a>
<?php
}

The other question of having different delay in each image. 另一个问题是每个图像的延迟不同。 It depends upon which Image Slider are you using. 这取决于您使用的图像滑块。

You first have to find and Image Slider Plugin which allows to have different delays in each slide 首先,您必须找到和Image Slider Plugin,该插件允许每张幻灯片具有不同的延迟

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM