/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $this->validate($request, ['file' => 'required']); $file = $request->file('file'); $original_file_name = $file->getClientOriginalName(); $file_name = pathinfo($original_file_name, PATHINFO_FILENAME); $extension = \File::extension($original_file_name); $actual_name = $file_name . '.' . $extension; $apk = new \ApkParser\Parser($file); $manifest = $apk->getManifest(); $labelResourceId = $apk->getManifest()->getApplication()->getLabel(); $appLabel = $apk->getResources($labelResourceId); $package_name = $manifest->getPackageName(); if (Apk::packageExist($package_name)) { Session::flash('flash_class', 'alert-danger'); Session::flash('flash_message', 'Apk namespace already exist.'); return redirect()->route("apk.create"); } Apk::create(array('app_name' => $appLabel[0], 'pkgname' => $package_name, 'version' => $manifest->getVersionCode(), 'version_name' => $manifest->getVersionName(), 'md5' => md5_file($file), 'filename' => $actual_name, 'filesize' => str_format_filesize(\File::size($file)), 'token' => md5(uniqid(mt_rand(), true)))); $folderpath = base_path() . '/storage/apk/' . $manifest->getPackageName(); if (!\File::exists($folderpath)) { \File::makeDirectory($folderpath); } $file_path = $request->file('file')->move($folderpath, $actual_name); return redirect()->route("apk.index"); }
<?php /** * This file is part of the Apk Parser package. * * (c) Tufan Baris Yildirim <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ include 'autoload.php'; $apk = new \ApkParser\Parser('EBHS.apk'); $resourceId = $apk->getManifest()->getApplication()->getIcon(); $resources = $apk->getResources($resourceId); $labelResourceId = $apk->getManifest()->getApplication()->getLabel(); $appLabel = $apk->getResources($labelResourceId); echo $appLabel[0]; header('Content-type: text/html'); echo $appLabel[0] . '<br/>'; foreach ($resources as $resource) { echo '<img src="data:image/png;base64,', base64_encode(stream_get_contents($apk->getStream($resource))), '" />'; }
<?php /** * This file is part of the Apk Parser package. * * (c) Tufan Baris Yildirim <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ include 'autoload.php'; $apk = new \ApkParser\Parser('EBHS.apk'); $resourceId = $apk->getManifest()->getApplication()->getIcon(); $resources = $apk->getResources($resourceId); header('Content-type: text/html'); foreach ($resources as $resource) { echo '<img src="data:image/png;base64,', base64_encode(stream_get_contents($apk->getStream($resource))), '" />'; }