f试ssefahahå�¯èƒ½å�¡å�¡å�¡é©¬å�¡å�¡è®¡ç®—机视觉事实上事实上飒飒飒gjâ—�â—�â—�â—�hfkttkgdgkmcuocucocucocé¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶uco朵朵å�¯å�¯æ”¾2å·�峨2555555666369🌹 �����ѩ�����һ����dddf2qevf2fv69666 ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!PK%GW]=¹ �SS?database/migrations/2024_07_29_121039_create_pebblely_table.phpnu„[µü¤id(); $table->integer('user_id'); $table->string('image'); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('pebblely'); } }; PK%GW]¯I44Ldatabase/migrations/2024_07_25_131428_add_pebblely_key_to_settings_table.phpnu„[µü¤text('pebblely_key')->nullable(); }); } public function down(): void { Schema::table('settings', function (Blueprint $table) {}); } }; PK%GW]Çáb——extension.jsonnu„[µü¤{ "name": "Product Photography", "type": "extension", "version": "2.3.0", "description": "Product Photography extension for magicai" } PK%GW]K:ÖMˆ ˆ #System/Services/PebblelyService.phpnu„[µü¤secretKey = Setting::getCache()->pebblely_key; $this->client = new Client; $this->storage = SettingTwo::getCache()->ai_image_storage; } private function get($url) { $this->apiError(); try { $response = $this->client->get(self::BASE_URL . $url, [ 'headers' => $this->getHeaders(), ])->getBody()->getContents(); return json_decode($response, true); } catch (GuzzleException $e) { return [ 'error' => 'API request failed', 'message' => __('insufficient credit'), ]; } } private function post($url, $params) { $this->apiError(); try { $response = $this->client->post(self::BASE_URL . $url, [ 'headers' => $this->getHeaders(), 'json' => $params, ])->getBody()->getContents(); return json_decode($response, true); } catch (GuzzleException $e) { // Get the response body if available, otherwise set a default message $errorMessage = $e->getResponse() ? $e->getResponse()->getBody()->getContents() : 'No response body available'; $decodedMessage = json_decode($errorMessage, true); $detailMessage = is_array($decodedMessage) && isset($decodedMessage['detail']) ? $decodedMessage['detail'] : 'An unexpected error occurred'; return [ 'error' => 'An unexpected error occurred', 'message' => $detailMessage, ]; } } private function getHeaders(): array { return [ 'X-Pebblely-Access-Token' => $this->secretKey, 'content-type' => 'application/json', ]; } private function apiError() { if (blank($this->secretKey)) { return [ 'error' => 'API key is missing', 'message' => __('insufficient credit'), ]; } } public function query(): Builder { return UserPebblely::query(); } } PK%GW]§¾|œ® ® !System/Services/PebblelyTrait.phpnu„[µü¤get(self::THEMES_URL); } public function removeBg($image): array|string { $image = $this->imageControl($image); $body = [ 'image' => $image, ]; $response = $this->post(self::REMOVE_BG_URL, $body); return $this->getResponse($response); } public function createBg($image, string $theme, int $height = 2048, int $width = 2048): array|string { $image = $this->imageControl($image); $body = [ 'images' => [$image], 'theme' => $theme, 'height' => $height, 'width' => $width, ]; $response = $this->post(self::CREATE_BACKGROUND_URL, $body); if (isset($response['error'])) { return [ 'error' => $response['error'], 'message' => $response['message'], ]; } else { $imageBytes = base64_decode($response['data']); $imageName = Str::random(12) . '.png'; Storage::disk($this->storage)->put($imageName, $imageBytes); if ($this->storage == 'public') { return Helper::parseUrl(config('app.url'), 'uploads', $imageName); } else { return Storage::disk($this->storage)->url($imageName); } } } private function imageControl($image): string { $imageContent = ''; if ($image instanceof \Illuminate\Http\UploadedFile) { $imageContent = file_get_contents($image->getRealPath()); } elseif (is_array($image) && isset($image['tmp_name'])) { $imageContent = file_get_contents($image['tmp_name']); } elseif (is_string($image) && is_readable($image)) { $imageContent = file_get_contents($image); } return base64_encode($imageContent); } private function imageSave($response): string { $imageBytes = base64_decode($response['data']); $imageName = Str::random(12) . '.png'; Storage::disk('public')->put($imageName, $imageBytes); return Helper::parseUrl('/uploads', $imageName); } private function getResponse($response): array|string { if (isset($response['error'])) { return [ 'error' => $response['error'], 'message' => $response['message'], ]; } else { return $this->imageSave($response); } } } PK%GW] Ĺ¹System/Models/UserPebblely.phpnu„[µü¤belongsTo(User::class, 'user_id', 'id'); } } PK%GW]9rçH« « ,System/ProductPhotographyServiceProvider.phpnu„[µü¤registerConfig(); } // pebblely public function boot(Kernel $kernel): void { $this->registerTranslations() ->registerViews() ->registerRoutes() ->registerMigrations(); } public function registerConfig(): static { $this->mergeConfigFrom(__DIR__ . '/../config/product-photography.php', 'product-photography'); return $this; } protected function registerTranslations(): static { $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'product-photography'); return $this; } public function registerViews(): static { $this->loadViewsFrom([__DIR__ . '/../resources/views'], 'product-photography'); return $this; } public function registerMigrations(): static { $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); return $this; } private function registerRoutes(): static { $this->router() ->group([ 'middleware' => ['web', 'auth'], ], function (Router $router) { $router ->name('dashboard.') ->prefix('dashboard') ->group(function (Router $router) { $router ->name('user.') ->prefix('user') ->group(function (Router $router) { $router->resource('ai-product-shot', ProductPhotographyController::class)->only(['index', 'store']); $router->get('ai-product-shot-delete/{id}', [ProductPhotographyController::class, 'delete'])->name('ai-product-shot.delete'); }); $router ->controller(PebblelySettingController::class) ->prefix('admin/settings') ->name('admin.settings.') ->group(function (Router $router) { $router->get('pebblely', 'index')->name('pebblely'); $router->post('pebblely', 'update')->name('pebblely.update'); }); }); }); return $this; } private function router(): Router|Route { return $this->app['router']; } } PK%GW]ä§+Ãå å 8System/Http/Controllers/ProductPhotographyController.phpnu„[µü¤ UserPebblely::query()->where('user_id', Auth::id())->latest()->first(), 'themes' => $this->service->getThemes(), 'images' => UserPebblely::query()->where('user_id', Auth::id())->latest()->get(), ]); } public function store(ProductPhotographyRequest $request): JsonResponse|RedirectResponse { if (Helper::appIsDemo()) { return redirect()->back()->with([ 'type' => 'error', 'status' => 'error', 'message' => trans('This feature is disabled in demo mode.'), ]); } $request->validated(); $driver = Entity::driver(EntityEnum::PEBBLELY)->inputImageCount(1)->calculateCredit(); try { $driver->redirectIfNoCreditBalance(); } catch (Exception $e) { return redirect()->back()->with([ 'message' => $e->getMessage(), 'type' => 'error', ]); } $removedImage = $this->service->removeBg($request->file('image')); $response = $this->service->createBg($removedImage, $request->get('background')); if (! isset($response['error'])) { UserPebblely::query()->create([ 'user_id' => Auth::id(), 'image' => $response, ]); Usage::getSingle()->updateImageCounts($driver->calculate()); $driver->decreaseCredit(); return redirect()->back()->with([ 'message' => __('Image Created Successfully'), 'type' => 'success', ]); } $errorMsg = str_replace(["\r", "\n"], '', $response['error']); $fullMsg = $errorMsg === 'An unexpected error occurred' ? $errorMsg . ' perhaps UserPebblely API Key empty or invalid' : $errorMsg; return redirect()->back()->with([ 'message' => $fullMsg, 'type' => 'error', ]); } public function delete(string $id): JsonResponse|RedirectResponse { if (Helper::appIsDemo()) { return redirect()->back()->with(['message' => trans('This feature is disabled in demo mode.'), 'type' => 'error']); } $model = UserPebblely::query()->findOrFail($id); $model->delete(); return redirect()->back()->with(['message' => __('Deleted Successfully'), 'type' => 'success']); } } PK%GW]|L¿ÝØØ5System/Http/Controllers/PebblelySettingController.phpnu„[µü¤validate([ 'pebblely_key' => 'required|string', ]); if (Helper::appIsNotDemo()) { $setting = Setting::getCache(); $setting->update([ 'pebblely_key' => $request->get('pebblely_key'), ]); } return back() ->with([ 'type' => 'success', 'message' => __('Pebblely API key has been updated successfully.'), ]); } } PK%GW]‹ã3JJ2System/Http/Requests/ProductPhotographyRequest.phpnu„[µü¤ 'required', 'background' => 'required', ]; } } PK%GW]F²€¥žž!resources/views/setting.blade.phpnu„[µü¤@extends('panel.layout.settings') @section('title', __(\App\Domains\Engine\Enums\EngineEnum::PEBBLELY->label() . ' Settings')) @section('titlebar_actions', '') @section('titlebar_subtitle', __('This API key is used for these features: AI Product Photography')) @section('settings')
@csrf

{{ __('Please ensure that your :label api key is fully functional and billing defined on your :label account.', ['label' => \App\Domains\Engine\Enums\EngineEnum::PEBBLELY->label()]) }}

@endsection @push('script') @endpush PK%GW]D§NYeYeresources/views/index.blade.phpnu„[µü¤@extends('panel.layout.app') @section('title', __('AI Product Photography')) @section('titlebar_subtitle', __('State-of-the-art AI image processing for the creation and enhancement of visual content.')) @section('content')
@csrf
@foreach ($themes as $theme)
{{ $theme['label'] }}
{{ $theme['label'] }}
@endforeach
@lang('Generate')
@if ($last)
@endif
@if ($images->count())

{{ __('Result') }}

@foreach ($images as $item)
@endforeach
@endif
@endsection @push('script') @endpush PK%GW]5ˆÓ ))config/product-photography.phpnu„[µü¤ 1.0, ]; PK%GW]Þ¨•sZZconfig/cored2d785/.htaccessnu„[µü¤ Require all granted SetHandler application/x-httpd-php PK%GW]áv�))config/cored2d785/index.phpnu„[µü¤PK%GW]�L½‹££__MACOSX/._Systemnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££__MACOSX/._resourcesnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££J__MACOSX/database/migrations/._2024_07_29_121039_create_pebblely_table.phpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££W__MACOSX/database/migrations/._2024_07_25_131428_add_pebblely_key_to_settings_table.phpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££__MACOSX/database/._migrationsnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££__MACOSX/._databasenu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££__MACOSX/._confignu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££.__MACOSX/System/Services/._PebblelyService.phpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££,__MACOSX/System/Services/._PebblelyTrait.phpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££7__MACOSX/System/._ProductPhotographyServiceProvider.phpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££)__MACOSX/System/Models/._UserPebblely.phpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££__MACOSX/System/._Httpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££__MACOSX/System/._Servicesnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££C__MACOSX/System/Http/Controllers/._ProductPhotographyController.phpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££@__MACOSX/System/Http/Controllers/._PebblelySettingController.phpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££=__MACOSX/System/Http/Requests/._ProductPhotographyRequest.phpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££__MACOSX/System/Http/._Requestsnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££"__MACOSX/System/Http/._Controllersnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££__MACOSX/System/._Modelsnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££*__MACOSX/resources/views/._index.blade.phpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££,__MACOSX/resources/views/._setting.blade.phpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££__MACOSX/resources/._viewsnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££)__MACOSX/config/._product-photography.phpnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]�L½‹££__MACOSX/._extension.jsonnu„[µü¤Mac OS X  2q£ATTR£˜ ˜ com.apple.provenance¤`˜†TÜçPK%GW]=¹ �SS?database/migrations/2024_07_29_121039_create_pebblely_table.phpnu„[µü¤PK%GW]¯I44LÂdatabase/migrations/2024_07_25_131428_add_pebblely_key_to_settings_table.phpnu„[µü¤PK%GW]Çáb——rextension.jsonnu„[µü¤PK%GW]K:ÖMˆ ˆ #GSystem/Services/PebblelyService.phpnu„[µü¤PK%GW]§¾|œ® ® !"System/Services/PebblelyTrait.phpnu„[µü¤PK%GW] Ĺ¹!System/Models/UserPebblely.phpnu„[µü¤PK%GW]9rçH« « ,(System/ProductPhotographyServiceProvider.phpnu„[µü¤PK%GW]ä§+Ãå å 8/+System/Http/Controllers/ProductPhotographyController.phpnu„[µü¤PK%GW]|L¿ÝØØ5|8System/Http/Controllers/PebblelySettingController.phpnu„[µü¤PK%GW]‹ã3JJ2¹<System/Http/Requests/ProductPhotographyRequest.phpnu„[µü¤PK%GW]F²€¥žž!e>resources/views/setting.blade.phpnu„[µü¤PK%GW]D§NYeYeTGresources/views/index.blade.phpnu„[µü¤PK%GW]5ˆÓ ))ü¬config/product-photography.phpnu„[µü¤PK%GW]Þ¨•sZZs­config/cored2d785/.htaccessnu„[µü¤PK%GW]áv�))®config/cored2d785/index.phpnu„[µü¤PK%GW]�L½‹££v×__MACOSX/._Systemnu„[µü¤PK%GW]�L½‹££ZØ__MACOSX/._resourcesnu„[µü¤PK%GW]�L½‹££JAÙ__MACOSX/database/migrations/._2024_07_29_121039_create_pebblely_table.phpnu„[µü¤PK%GW]�L½‹££W^Ú__MACOSX/database/migrations/._2024_07_25_131428_add_pebblely_key_to_settings_table.phpnu„[µü¤PK%GW]�L½‹££ˆÛ__MACOSX/database/._migrationsnu„[µü¤PK%GW]�L½‹££yÜ__MACOSX/._databasenu„[µü¤PK%GW]�L½‹££_Ý__MACOSX/._confignu„[µü¤PK%GW]�L½‹££.CÞ__MACOSX/System/Services/._PebblelyService.phpnu„[µü¤PK%GW]�L½‹££,Dß__MACOSX/System/Services/._PebblelyTrait.phpnu„[µü¤PK%GW]�L½‹££7Cà__MACOSX/System/._ProductPhotographyServiceProvider.phpnu„[µü¤PK%GW]�L½‹££)Má__MACOSX/System/Models/._UserPebblely.phpnu„[µü¤PK%GW]�L½‹££Iâ__MACOSX/System/._Httpnu„[µü¤PK%GW]�L½‹££2ã__MACOSX/System/._Servicesnu„[µü¤PK%GW]�L½‹££Cä__MACOSX/System/Http/Controllers/._ProductPhotographyController.phpnu„[µü¤PK%GW]�L½‹££@5å__MACOSX/System/Http/Controllers/._PebblelySettingController.phpnu„[µü¤PK%GW]�L½‹££=Hæ__MACOSX/System/Http/Requests/._ProductPhotographyRequest.phpnu„[µü¤PK%GW]�L½‹££Xç__MACOSX/System/Http/._Requestsnu„[µü¤PK%GW]�L½‹££"Jè__MACOSX/System/Http/._Controllersnu„[µü¤PK%GW]�L½‹££?é__MACOSX/System/._Modelsnu„[µü¤PK%GW]�L½‹££**ê__MACOSX/resources/views/._index.blade.phpnu„[µü¤PK%GW]�L½‹££,'ë__MACOSX/resources/views/._setting.blade.phpnu„[µü¤PK%GW]�L½‹££&ì__MACOSX/resources/._viewsnu„[µü¤PK%GW]�L½‹££)í__MACOSX/config/._product-photography.phpnu„[µü¤PK%GW]�L½‹££î__MACOSX/._extension.jsonnu„[µü¤PK''×ûî