Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Enhancement: Generate icons / splashes straight into platform folders - Android and iOS #4

Open
ghost opened this issue Jan 16, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 16, 2014

I added a few lines so that, when this script is run from the root folder of a PhoneGap project (the one containing all the platforms) the default phonegap robot icons for Android and iOS are overwritten with the new one. Annoyingly, for iOS you still have to define them in Xcode, but if you use Asset Catalogs you probably only have to do that once.

The code:

After

[ "$3" ] || set "$1" "$2" "."

I added these lines to grab the folder name, ie the name of the project. Within the iOS project structure, there's a folder with the same name as the project, so the code needs to grab that so it can write directly into the iOS project.

proj=${PWD##*/};
echo "project name: $proj";

These lines go after the other icon generating lines:

$convert "$1" -resize 36x36 "$3/platforms/android/res/drawable-ldpi/icon.png"
$convert "$1" -resize 72x72 "$3/platforms/android/res/drawable-hdpi/icon.png"
$convert "$1" -resize 96x96 "$3/platforms/android/res/drawable-xhdpi/icon.png"
$convert "$1" -resize 48x48 "$3/platforms/android/res/drawable-mdpi/icon.png"
$convert "$1" -resize 96x96 "$3/platforms/android/res/drawable/icon.png"
$convert "$1" -resize 57x57 "$3/platforms/ios/$proj/Resources/icons/icon.png"
$convert "$1" -resize 114x114 "$3/platforms/ios/$proj/Resources/icons/[email protected]"
$convert "$1" -resize 29x29 "$3/platforms/ios/$proj/Resources/icons/icon-small.png"
$convert "$1" -resize 58x58 "$3/platforms/ios/$proj/Resources/icons/[email protected]"
$convert "$1" -resize 76x76 "$3/platforms/ios/$proj/Resources/icons/icon-76.png"
$convert "$1" -resize 152x152 "$3/platforms/ios/$proj/Resources/icons/[email protected]"
$convert "$1" -resize 72x72 "$3/platforms/ios/$proj/Resources/icons/icon-72.png"
$convert "$1" -resize 144x144 "$3/platforms/ios/$proj/Resources/icons/[email protected]"
$convert "$1" -resize 60x60 "$3/platforms/ios/$proj/Resources/icons/icon-60.png"
$convert "$1" -resize 120x120 "$3/platforms/ios/$proj/Resources/icons/[email protected]"
$convert "$1" -resize 50x50 "$3/platforms/ios/$proj/Resources/icons/icon-50.png"
$convert "$1" -resize 100x100 "$3/platforms/ios/$proj/Resources/icons/[email protected]"
$convert "$1" -resize 40x40 "$3/platforms/ios/$proj/Resources/icons/icon-40.png"
$convert "$1" -resize 80x80 "$3/platforms/ios/$proj/Resources/icons/[email protected]"

..and these lines go after the splash generating lines:

$convert -resize 512x512 -extent 768x1004 "$3/platforms/ios/$proj/Resources/splash/Default-768x1004.png"
$convert -resize 1024x1024 -extent 1536x2008 "$3/platforms/ios/$proj/Resources/splash/Default~ipad-1536x2008.png"
$convert -resize 512x512 -extent 1024x748 "$3/platforms/ios/$proj/Resources/splash/Default-Landscape-1024x748.png"
$convert -resize 512x512 -extent 2048x1496 "$3/platforms/ios/$proj/Resources/splash/[email protected]"
$convert -resize 256x256 -extent 320x480 "$3/platforms/ios/$proj/Resources/splash/Default~iphone.png"
$convert -resize 256x256 -extent 960x640 "$3/platforms/ios/$proj/Resources/splash/Default-Landscape@2x~iphone.png"
$convert -resize 256x256 -extent 480x320 "$3/platforms/ios/$proj/Resources/splash/Default-Landscape~iphone.png"
$convert -resize 512x512 -extent 768x1024 "$3/platforms/ios/$proj/Resources/splash/Default-Portrait~ipad-768x1024.png"
$convert -resize 1024x1024 -extent 1536x2048 "$3/platforms/ios/$proj/Resources/splash/Default-Portrait@2x~ipad-1536x2048.png"
$convert -resize 512x512 -extent 1024x768 "$3/platforms/ios/$proj/Resources/splash/Default-Landscape~ipad-1024x768.png"
$convert -resize 256x256 -extent 640x960 "$3/platforms/ios/$proj/Resources/splash/Default@2x~iphone.png"
$convert -resize 256x256 -extent 640x1136 "$3/platforms/ios/$proj/Resources/splash/Default-568h@2x~iphone.png"
$convert -resize 1024x1024 -extent 2048x1536 "$3/platforms/ios/$proj/Resources/splash/Default-Landscape@2x~ipad-2048x1536.png"
@tlvince
Copy link
Owner

tlvince commented Jan 17, 2014

I've committed your patch in fbce988 (so it's easier to see the diff).

I haven't used phonegap in a while, but will review your patch soon. Thanks for your contribution.

@tlvince
Copy link
Owner

tlvince commented Mar 24, 2014

@nbirch, does #5 help with this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant