diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b488d2e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM omidshj/laravel-dev + +# RUN apt install -y php-dev +RUN apt-get -y update +RUN apt-get -y install libffi-dev +RUN docker-php-ext-configure ffi --with-ffi \ + && docker-php-ext-install ffi +RUN apt-get -y install --no-install-recommends libvips42 +RUN apt-get -y install libvips-tools +RUN apt-get -y install libvips-dev +RUN pecl install vips +RUN echo 'extension="vips.so"' > /usr/local/etc/php/conf.d/20-vips.ini + +COPY ./php.ini /usr/local/etc/php/php.ini diff --git a/docker-compose.yml b/docker-compose.yml index 658ea50..cb06596 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: laravel: - image: omidshj/laravel-dev + build: . container_name: app user: "1000:${GID}" ports: diff --git a/php.ini b/php.ini new file mode 100644 index 0000000..bc849bf --- /dev/null +++ b/php.ini @@ -0,0 +1 @@ +ffi.enable = "true" diff --git a/public/image.jpg b/public/image.jpg new file mode 100644 index 0000000..54e5b4f Binary files /dev/null and b/public/image.jpg differ diff --git a/routes/web.php b/routes/web.php index be49a05..7ba0d1e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -13,23 +13,21 @@ use Illuminate\Support\Facades\Route; | */ -Route::get('/update', function () { - $user = \App\Models\User::first(); - $user->fill(['name' => 'xxxxxx']); - $user->saveRich(); +// Route::get('/update', function () { +// $user = \App\Models\User::first(); +// $user->fill(['name' => 'xxxxxx']); +// $user->saveRich(); - return 'done'; - return view('welcome'); -}); +// return 'done'; +// return view('welcome'); +// }); Route::get('/', function () { - $user = new \App\Models\User([ - 'name'=>'test', - 'email' => 'aaaa', - 'status' => "active" + + $image = Image::thumbnail('../public/image.jpg', $request->w); + $image->writeToFile('image-modified.jpg',[ + 'Q' => $request->q ]); - $user->saveRich(); + echo ''; - return 'done'; - return view('welcome'); });