} else { $db->exec('UPDATE photos SET downloaded_768px_photo = 1 WHERE rowid =' . $photoId); } } //***** Add as many icon photos as possible until the folder hits the max content size ***** $results2 = $db->query('SELECT DISTINCT(icon_photo_id) FROM entries, photos WHERE icon_photo_id = photos.rowid'); $iconPhotoCount = 0; //$maxNumberOfIconPhotos = 200; foreach ($results2 as $row2) { $iconPhotoCount++; $photoId = $row2['icon_photo_id']; if (disk_usage_kilobytes($appFolder . '/' . $appId . ' Static Content/') > $maxContentSize) { echo "Hit size limit adding icon photos after " . $iconPhotoCount . " photos \n"; break; } $downloadStatus = downloadPhoto($photoId, $allPhotosFolder, $appFolder . '/' . $appId . ' Static Content/images/'); if ($downloadStatus) { array_push($brokenImages, $photoId); } else { $db->exec('UPDATE photos SET downloaded_320px_photo = 1 WHERE rowid =' . $photoId); //echo 'Adding 320 pix photo for '.$photoId."\n"; } //if($iconPhotoCount > $maxNumberOfIconPhotos) break; } //***** Get screen shots ***** $iPhoneScreenshotPhotoIds = explode(',', $appProperties['iphone_screenshot_ordering']); $screenshotCounter = 1; foreach ($iPhoneScreenshotPhotoIds as $iPhoneScreenshotPhotoId) { $imageFilename = $screenshotFolder . '/' . $screenshotCounter . '-iphone' . '.jpg'; downloadFile('http://sutromedia.com/published/ipad-sized-photos/' . $iPhoneScreenshotPhotoId . '.jpg', $imageFilename, $allPhotosFolder . '/' . $iPhoneScreenshotPhotoId . '_iphone_retinal_screenshot.jpg'); $imageSize = getimagesize($imageFilename);
echo 'about to run... convert ' . escapeshellarg($srcSplashFilename) . ' -resize 768x1024! -depth 7 -quality 80% ' . escapeshellarg($iPadSplashFilename) . ' '; system('convert -limit area 512mb -limit memory 512mb -limit map 512mb ' . escapeshellarg($srcSplashFilename) . ' -resize 768x1024! -depth 7 -quality 80% ' . escapeshellarg($iPadSplashFilename)); echo 'splash screens generated... removing splash screen source file '; if (file_exists($srcSplashFilename)) { unlink($srcSplashFilename); } //var_dump($appProperties); $buildSyncLevel = (int) $appProperties['build_sync_level']; kdebug('found build_sync_level property = ' . $buildSyncLevel); if ($buildSyncLevel > 0) { kdebug('buildSyncLevel > 0'); $results2 = $db->query('SELECT DISTINCT(photoid) FROM (SELECT rowid AS photoid FROM photos UNION SELECT DISTINCT(icon_photo_id) AS photoid FROM entries)'); foreach ($results2 as $row2) { $downloadStatus = downloadPhoto($row2['photoid'], $allPhotosFolder, $appFolder . '/' . $appId . ' Static Content/images/'); if ($downloadStatus) { array_push($brokenImages, $row2['photoid']); } } } $iPhoneScreenshotPhotoIds = explode(',', $appProperties['iphone_screenshot_ordering']); $screenshotCounter = 1; foreach ($iPhoneScreenshotPhotoIds as $iPhoneScreenshotPhotoId) { downloadFile('http://sutromedia.com/published/iphone-sized-photos/' . $iPhoneScreenshotPhotoId . '.jpg', $screenshotFolder . '/' . $screenshotCounter++ . '-iphone' . '.jpg', $allPhotosFolder . '/' . $iPhoneScreenshotPhotoId . '_iphone_screenshot.jpg'); } copy($iPhoneSplashFilename, $screenshotFolder . '/Default.jpg'); $iPadScreenshotPhotoIds = explode(',', $appProperties['ipad_screenshot_ordering']); $screenshotCounter = 1; foreach ($iPadScreenshotPhotoIds as $iPadScreenshotPhotoId) { downloadFile('http://sutromedia.com/published/ipad-sized-photos/' . $iPadScreenshotPhotoId . '.jpg', $screenshotFolder . '/' . $screenshotCounter++ . '-ipad' . '.jpg', $allPhotosFolder . '/' . $iPadScreenshotPhotoId . '_ipad_screenshot.jpg');