Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Dropbox图像库_Php_Wordpress_Wordpress Theming_Dropbox - Fatal编程技术网

Php Dropbox图像库

Php Dropbox图像库,php,wordpress,wordpress-theming,dropbox,Php,Wordpress,Wordpress Theming,Dropbox,我正试图从Dropbox在wordpress中创建一个图像库。在wordpres中,我安装了插件“CloudFolderShare”,可以从Dropbox特定的文件夹中读取信息。问题是它列出了我在这个文件夹中的所有文件,但我需要他显示我的这些文件/图像。有人能帮我做这件事吗。或者有人知道从Dropbox或Google Drive共享文件夹创建图像库的其他解决方案吗? 也许有人知道我可以在php文件中编辑什么来获取图像,而不是它的名称,并在dropbox上链接到它。 多谢各位 核心API将是这方面

我正试图从Dropbox在wordpress中创建一个图像库。在wordpres中,我安装了插件“CloudFolderShare”,可以从Dropbox特定的文件夹中读取信息。问题是它列出了我在这个文件夹中的所有文件,但我需要他显示我的这些文件/图像。有人能帮我做这件事吗。或者有人知道从Dropbox或Google Drive共享文件夹创建图像库的其他解决方案吗? 也许有人知道我可以在php文件中编辑什么来获取图像,而不是它的名称,并在dropbox上链接到它。
多谢各位

核心API将是这方面的最佳选择。您可以找到用于核心API的官方PHPSDK

有一个入门指南

完整的文档是

例如,可以使用此方法获取图像文件的缩略图。这里有一个例子

这真的很简单。下面是一个来自以下链接的片段,您将找到解决问题的简单方法(包括演示)

/**设置**/
$images_dir='';
$thumbs_dir='';
$thumbs_width=200;
$images\u/行=3;
/**生成照片库**/
$image\u files=获取文件($images\u dir);
如果(计数($image_文件)){
$index=0;
foreach($index=>$file形式的图像文件){
$index++;
$thumbnail\u image=$thumbs\u dir.$file;
如果(!file_存在($thumbnail_image)){
$extension=get_file_extension($thumbnail_image);
如果($延期){
制作拇指($images\u dir.$file、$thumbnail\u image、$thumbs\u width);
}
}
回声';
如果($index%$images_per_row==0){echo';}
}
回声';
}
否则{
echo“此库中没有图像。

”; }
我希望你现在能找到一个积极的解决办法

/** settings **/
 $images_dir = '<path-to-your-dropbox>';
 $thumbs_dir = '<path-to-your-generated thumbnails>';
 $thumbs_width = 200;
 $images_per_row = 3;

 /** generate photo gallery **/
 $image_files = get_files($images_dir);
 if(count($image_files)) {
 $index = 0;
 foreach($image_files as $index=>$file) {
 $index++;
 $thumbnail_image = $thumbs_dir.$file;
 if(!file_exists($thumbnail_image)) {
  $extension = get_file_extension($thumbnail_image);
  if($extension) {
    make_thumb($images_dir.$file,$thumbnail_image,$thumbs_width);
  }
}
   echo '<a href="',$images_dir.$file,'" class="photo-link smoothbox" rel="gallery"><img src="',$thumbnail_image,'" /></a>';
   if($index % $images_per_row == 0) { echo '<div class="clear"></div>';                                                  }
 }
 echo '<div class="clear"></div>';
  }
 else {
  echo '<p>There are no images in this gallery.</p>';
}