Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Update/deps #423

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'

- name: Setup MySQL
uses: mirromutth/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use the specified image as the base
FROM php:8.2-fpm
FROM php:8.4-fpm

# Install system dependencies, PHP extensions, and Node.js
RUN apt-get update && apt-get install -y \
Expand Down
10 changes: 8 additions & 2 deletions app/Http/Controllers/AgendaItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
use App\Repositories\ApplicationFormRepositories\ApplicationFormRepository;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Intervention\Image\ImageManagerStatic as Image;
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;

class AgendaItemController extends Controller
{
private $_agendaItemRepository;
private $_agendaItemCategoryRepository;
private $_applicationFormRepository;
private $_imageManager;

public function __construct(
AgendaItemRepository $agendaItemRepository,
Expand All @@ -27,6 +29,7 @@
$this->_agendaItemRepository = $agendaItemRepository;
$this->_agendaItemCategoryRepository = $agendaItemCategoryRepository;
$this->_applicationFormRepository = $applicationFormRepository;
$this->_imageManager = new ImageManager(new Driver());
}

public function index()
Expand Down Expand Up @@ -140,8 +143,11 @@
$request->file('thumbnail')->storeAs('agendaItem', $name, 'public');
$agendaItem->image_url = 'agendaItem/' . $name;
$agendaItem->save();

$img_path = "../storage/app/public/" . $agendaItem->image_url;
Image::make($img_path)->fit(400, 300)->save($img_path);
$image = $this->_imageManager->read($img_path);
$image->cover(400, 300);
$image->save();

Check warning on line 150 in app/Http/Controllers/AgendaItemController.php

View check run for this annotation

Codecov / codecov/patch

app/Http/Controllers/AgendaItemController.php#L148-L150

Added lines #L148 - L150 were not covered by tests
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

//retrieves all the rows of the form
$rows = ApplicationFormRowVueResource::collection($applicationForm->applicationFormRows);
$route = 'forms/' . $agendaItem->id; //route for the form sign up
$route = url('forms/' . $agendaItem->id);

Check warning on line 60 in app/Http/Controllers/ApplicationForm/UserApplicationFormController.php

View check run for this annotation

Codecov / codecov/patch

app/Http/Controllers/ApplicationForm/UserApplicationFormController.php#L60

Added line #L60 was not covered by tests
$cancleRoute = 'agenda/' . $agendaItem->id; //route for the form sign up

$curPageName = $applicationForm->name;
Expand Down
13 changes: 9 additions & 4 deletions app/Http/Controllers/NewsItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Storage;
use Intervention\Image\ImageManagerStatic as Image;
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;

class NewsItemController extends Controller
{
private $_newsItemRepository;
private $_imageManager;

public function __construct(NewsItemRepository $newsItemRepository)
{
$this->middleware('auth');
$this->middleware('authorize:' . Config::get('constants.Content_administrator') . ',' . Config::get('constants.Activity_administrator'));

$this->_newsItemRepository = $newsItemRepository;
$this->_imageManager = new ImageManager(new Driver());
}

public function index()
Expand Down Expand Up @@ -92,15 +95,17 @@
$newsItem->thumbnail_url = 'newsItems/' . $thumbnailFileName;
$newsItem->save();

//resize both images
// Resize both images
$this->resizeImage($newsItem->image_url, 1200, 500);
$this->resizeImage($newsItem->thumbnail_url, 400, 300);
}

private function resizeImage(string $path, int $width, int $height)
{
$imagePath = Storage::path('public/' . $path);
Image::make($imagePath)->fit($width, $height)->save($imagePath);
$image = $this->_imageManager->read($imagePath);
$image->cover($width, $height);
$image->save();

Check warning on line 108 in app/Http/Controllers/NewsItemController.php

View check run for this annotation

Codecov / codecov/patch

app/Http/Controllers/NewsItemController.php#L106-L108

Added lines #L106 - L108 were not covered by tests
}

private function validateInput(Request $request)
Expand All @@ -110,4 +115,4 @@
'text' => 'required',
]);
}
}
}
43 changes: 19 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,25 @@
"license": "MIT",
"require": {
"php": "^8.2",
"doctrine/dbal": "^3.7",
"doctrine/dbal": "^3.8",
"eluceo/ical": "^2.12",
"intervention/image": "^2.7",
"laravel/framework": "10.*",
"intervention/image": "^3.0",
"laravel/framework": "^11.0",
"laravel/helpers": "^1.6",
"laravel/legacy-factories": "^1.3",
"laravel/tinker": "^2.8",
"laravel/ui": "^4.2",
"laravelcollective/html": "^6.4",
"laravel/tinker": "^2.9",
"laravel/ui": "^4.5",
"nunomaduro/collision": "^8.1",
"maatwebsite/excel": "^3.1",
"php-http/guzzle7-adapter": "^1.0",
"phpoffice/phpspreadsheet": "^1.22",
"spatie/laravel-blade-javascript": "^2.7"
"phpoffice/phpspreadsheet": "^1.29",
"spatie/laravel-blade-javascript": "^2.7",
"spatie/laravel-html": "^3.11"
},
"require-dev": {
"laravel/dusk": "^7.8",
"phpunit/phpunit": "^10.0",
"barryvdh/laravel-debugbar": "^3.6",
"laravel/dusk": "^8.2",
"phpunit/phpunit": "^11.0",
"barryvdh/laravel-debugbar": "^3.9",
"fakerphp/faker": "^1.23",
"mockery/mockery": "^1.6"
},
Expand Down Expand Up @@ -61,21 +62,15 @@
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
]
}
}
}
Loading
Loading