2013-12-20 75 views
0

我有一個PHP腳本,從csv文件中提取圖像URL並將它們下載到我們的服務器。當我在控制檯上運行這個腳本時,一切都很好!問題是,當這個腳本是從科雷稱它只是不斷給空的結果:腳本在控制檯中工作,但不在cron中?

<b>Warning</b>: imagejpeg() expects parameter 1 to be resource, null given in <b>/home/camera/public_html/simpleimage.php</b> on line <b>14</b><br /> 

幾乎像圖像無法從遠程服務器下載。

再次 該腳本從控制檯中運行時沒有問題地下載所有圖像,但是當cron什麼都不運行時被下載。

在此先感謝你們。

編輯 另一個說明。我有另一個腳本從另一臺服務器下載圖像,但它工作正常。這個腳本使用https調用圖像,這可能是問題嗎?

EDIT2: 代碼,保存圖像

function save($filename, $image_type = IMAGETYPE_JPEG, $compression = 75, $permissions = null) { 
    if ($image_type == IMAGETYPE_JPEG) { imagejpeg($this -> image, $filename, $compression); //line 14 
    } elseif ($image_type == IMAGETYPE_GIF) { imagegif($this -> image, $filename); 
    } elseif ($image_type == IMAGETYPE_PNG) { imagepng($this -> image, $filename); 
    } 
    if ($permissions != null) { chmod($filename, $permissions); 
    } 

代碼調用保存

$simpleImage->save('/home/camera/public_html/app/webroot/upload/uploads/'.substr($id, 0, 1).'/'.substr($id, 1, 1).'/'.substr($id, 2, 1).'/' . $id . '-' . $name . '_original.jpg'); 
+1

我們需要更多代碼,特別是第16行的simpleimage.php – deW1

+0

聲音像一些環境變量(路徑?)不初始化爲cron環境... – user2196728

+0

更新後的文章以及更多信息 – Rymn

回答

0

我不知道真正的原因,但問題鬆了一口氣一次自我我將協議從https更改爲http ..

相關問題