0
現在我們正在用最難的時間來重寫這個照片庫功能。它可以在與圖像相同的服務器上完美工作。由於昂貴的效果,現在我們必須將所有圖像移動到另一臺服務器。閱讀遠程服務器文件,列表目錄
圖庫功能在同一臺服務器上效果很好。當我們嘗試遠程服務器路徑時,如: http://www.myotherserver.com - 那麼這就是它返回NO圖像的地方?
我們發現讀取/列出沒有圖像文件的圖像的「函數」,但我們無法解碼它以在遠程服務器上使用它?
任何幫助或想法?謝謝。
下面是函數:
採取注::我們不打算使用一個.txt文件與圖像順序 - 我們只是希望腳本讀取目錄和清單圖片使用..
/**
* 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 'Image Path not working';
exit;
}
$image_number = count ($image_data);
有趣。謝謝你的建議。我將如何去關於NFS?此外,你認爲FTP功能會起作用嗎? – eberswine
@eberswine你可以嘗試使用FTP。在對這一問題的其他看看:http://stackoverflow.com/questions/4088805/getting-the-list-of-files-over-ftp 此外,關於NFS,也有很多教程在那裏,例如http://how-to.linuxcareer.com/how-to-configure-nfs-on-linux – mrzard