我有一个像这样工作的 PHP 照片库脚本:
$image_path = "../images/11/mycoolphotos/md";
如果脚本和照片在同一台服务器上,那就完美了!
但是,我们只是将所有图像传输到 Amazon S3 —— 所以路径是这样的:
$image_path = "https://s3.amazonaws.com/mywebsite/images/11/mycoolphotos/md";
但它不起作用!它不会读取 LIST 或 ../ Path 之类的文件?我可以包含一个“订单文件路径”并且它可以工作,但我们有 8000 个照片库!太多的工作 ?
$order_file_path = "https://s3.amazonaws.com/mywebsite/images/11/mycoolphotos.txt";
// this works, but it would take too much time. This just lists the image names, like 1.jpg, 2.jpg,.. so on for that gallery
我想知道我们是否在读取时欺骗服务器(不知道如何 .htaccess 重写这个)
https://s3.amazonaws.com/mywebsite/images/
作为
../
如果它会工作?
否则,我不确定从这里去哪里?
提前非常感谢!
编辑更新:我找到了 PATH 读取功能:有人可以解码吗?我尝试了以下建议,但没有运气....?
/**
* Check for image order file. In case it does not
* exists, read the image directory.
*/
if (is_file($order_file_path . '/' . $order_file_name)) {
$fp = fopen($order_file_path . '/' . $order_file_name, "r");
$row = '';
$use_order_file = 'true';
while ($data = fgetcsv ($fp, 1000, ';')) {
$image_data[] = trim($data[0]);
$image_file_names[trim($data[0])] = trim($data[0]);
$num = count($data);
$row++;
for ($j = 0; $j < $num; $j++) {
$content_data_temp['field_' . $j] = $data[$j];
}
$content_data[] = $content_data_temp;
$content_data_temp = '';
}
fclose ($fp);
} else if (is_dir($image_path)) {
$content_data = '';
$handle = opendir($image_path);
while ($file = readdir($handle)) {
if (preg_match("/^\.{1,2}$/i", $file)) {
continue;
}
if (preg_match("/\.[a-z]{3}$/i", $file)) {
$image_data[] = $file;
$image_file_names[$file] = $file;
}
}
closedir($handle);
} else {
echo 'Working on older photos, please check back.';
exit;
}
$image_number = count ($image_data);