app->filepickerScreenshots as $imageUrl) { $pos++; copyImageUrl($imageUrl, $dir . 'screenshot-' . $pos); } copyImageUrl($data->app->mainImageFullUrl, $dir . 'main'); echo "\n"; } function copyImageUrl($imageUrl, $newPath) { $imageLocal = getLocalPath($imageUrl); if (!file_exists($imageLocal)) { echo "Local file not found: $imageLocal\n"; return; } if (file_exists($newPath)) { echo "S"; return; } echo "."; copy($imageLocal, $newPath); file_put_contents( 'map-game-images.csv', $imageUrl . ',' . 'http://ouya.cweiske.de/' . $newPath . "\n", FILE_APPEND ); } function getLocalPath($imageUrl) { return str_replace('https://', '', $imageUrl); } ?>