如何显示文件夹中的所有.jpg图片,但我只想要今天的图片 [英] how do i show all .jpg pictures in a folder but i want only pictures from today

查看:795
本文介绍了如何显示文件夹中的所有.jpg图片,但我只想要今天的图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我能说清楚。我有一个摄像头,每秒钟都会向我的网站发送图片。他们总结在这样的文件夹中:

 (IPCAM)_0_20130413145714_62.jpg [Year:2013] [mo:04] [日:13] [小时:14] [分:57] [秒:14] 
(IPCAM)_0_20130413145719_63.jpg [年:2013] [mo:04] [日:13] [小时:14] [分:57] [秒:19]
(IPCAM)_0_20130413145723_64.jpg [年:2013] [月:04] [日:13] [小时:14] [分:57] [秒:23]
(IPCAM)_0_20130413145727_65.jpg [年:2013] [月:04] [日:13] [小时:14] [分:57] [秒:27]

你能看到图像名称中的模式吗?

 <?php 
$ dirname =./;
$ images = glob($ dirname。*。jpg);
foreach($ images as $ image){
echo'< img src =''。$ image。'/>< br />';
}
?>

我想要一个日历,以便我可以选择 [Day: **] 并获取当天拍摄的所有照片。



我希望有人可以帮我解决这个问题。

解决方案

您是否尝试过?

  $ dayInQuestion ='20130413'; 
glob($ dirname。(IPCAM)_0 _。$ dayInQuestion。*。jpg);

包含您的日期? $ b

Ref:更多选项的PHP手册,例如, http://www.php.net /manual/en/function.glob.php#110340


I hope I can make myself clear. I have a webcam that sends a picture at every second to my website. They all sum up in the folder like this:

(IPCAM)_0_20130413145714_62.jpg [Year: 2013] [mo: 04] [Day: 13] [Hour: 14] [min: 57] [Sec: 14]
(IPCAM)_0_20130413145719_63.jpg [Year: 2013] [mo: 04] [Day: 13] [Hour: 14] [min: 57] [Sec: 19]
(IPCAM)_0_20130413145723_64.jpg [Year: 2013] [mo: 04] [Day: 13] [Hour: 14] [min: 57] [Sec: 23]
(IPCAM)_0_20130413145727_65.jpg [Year: 2013] [mo: 04] [Day: 13] [Hour: 14] [min: 57] [Sec: 27]

Can you see the pattern in the image names? I am curently using this script to display them:

<?php 
$dirname = "./";
$images = glob($dirname."*.jpg");
foreach($images as $image) {
echo '<img src="'.$image.'" /><br />';
}
?>

I would like to have a calendar so I can select the [Day: **] and get all the pictures that were taken that day.

I hope someone can help me with this code.

解决方案

Did you try

$dayInQuestion = '20130413';
glob($dirname."(IPCAM)_0_".$dayInQuestion."*.jpg"); 

with your date?

Ref: PHP manual for more options eg., http://www.php.net/manual/en/function.glob.php#110340

这篇关于如何显示文件夹中的所有.jpg图片,但我只想要今天的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆