$version->setToken($folder_token);
                 $version->setDateUpload(new \DateTime('now'));
                 $entityManager->persist($application);
                 $entityManager->persist($version);
                 $entityManager->flush();
                 //even if application already exists, update icon with last version uploaded.
                 //Get icon, if empty use 'Icon.png'
                 if (isset($plistData['CFBundleIconFile'])) {
                     $iconFile = $plistData['CFBundleIconFile'];
                 } else {
                     $iconFile = 'Icon.png';
                 }
                 //uncrush icon
                 $pngPath = '../' . UPLOAD_PATH . $folder_token . '/app_bundle/Payload/' . $version->getName() . '.app/' . $iconFile;
                 if (file_exists($pngPath)) {
                     $png = new PngFile($pngPath);
                     $newPngPath = '../' . UPLOAD_PATH . $application->getBundleId() . '.png';
                     $png->revertIphone($newPngPath);
                 }
                 echo '<a href="application_list.php">Go back to Application list</a>';
             } else {
                 echo 'Error: Unable to read application plist file.<br />';
             }
         } else {
             echo 'Error: Unzip failed.<br />';
         }
     } else {
         echo 'Error: There was an error during the file upload.  Please try again.<br />';
     }
 } else {
     echo $error;
示例#2
0
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once 'pngCompote.php';
//for compat < 5.2
function mypathinfo($file)
{
    if (defined('PATHINFO_FILENAME')) {
        return pathinfo($file);
    }
    $pathinfo = pathinfo($file);
    if (strstr($file, '.')) {
        $fname = substr($pathinfo['basename'], 0, -strlen($pathinfo['extension']) - 1);
    } else {
        $fname = $pathinfo['basename'];
    }
    $pathinfo['filename'] = $fname;
    return $pathinfo;
}
$filename = 'Lenna.crush.png';
$newFilename = 'Lenna.compote.png';
$png = new PngFile($filename);
if ($png->isIphone) {
    if ($png->revertIphone(__DIR__ . '/' . $newFilename)) {
        echo 'cleaning done!' . PHP_EOL;
        echo '<img src="' . $newFilename . '"/>' . PHP_EOL;
    }
}