Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroto0701 committed Nov 21, 2024
1 parent 5aed733 commit f833201
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 14 deletions.
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
curry_addiction_nginx:
image: nginx:latest
build:
context: .
dockerfile: ./docker/nginx/Dockerfile
container_name: curry_addiction_nginx
volumes:
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
Expand Down
5 changes: 3 additions & 2 deletions docker/nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ FROM nginx:1.27-alpine

ENV TZ=Asia/Tokyo

RUN echo "${TZ}" > /etc/timezone \
&& dpkg-reconfigure -f noninteractive tzdata
RUN apk add --no-cache tzdata \
&& cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
&& echo "Asia/Tokyo" > /etc/timezone

# nginx config file
COPY ./docker/nginx/*.conf /etc/nginx/conf.d/
Expand Down
36 changes: 32 additions & 4 deletions frontend-user/src/views/pages/Dashboard/Setting/Index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import axios from 'axios';
import imageCompression from 'browser-image-compression';
import { ref, computed, onUnmounted } from 'vue';
import { useRouter } from 'vue-router';
import { useAccountStore } from '@/stores/account';
Expand Down Expand Up @@ -59,11 +60,38 @@ function closeModal(): void {
document.body.style.overflow = 'auto';
}
function handleFileSelected(event: Event): void {
async function handleFileSelected(event: Event) {
const compressionOptions = {
maxSizeMB: 1, // 最大1MB
maxWidthOrHeight: 1920, // 縦横最大1920px
useWebWorker: true,
initialQuality: 0.7 // 70%くらいの品質にする
};
const target = event.target as HTMLInputElement;
if (target.files && target.files.length > 0) {
fileInfo.value = target.files[0];
preview.value = URL.createObjectURL(fileInfo.value);
if (!target.files || target.files.length === 0) return;
try {
const originalFile = target.files[0];
if (!originalFile.type.startsWith('image/')) {
fileInfo.value = originalFile;
preview.value = URL.createObjectURL(originalFile);
return;
}
// 画像を圧縮
const compressedFile = await imageCompression(originalFile, compressionOptions);
fileInfo.value = compressedFile;
preview.value = URL.createObjectURL(compressedFile);
} catch (error) {
console.error('画像の圧縮中にエラーが発生しました:', error);
commonStore.setErrorMessage('画像の処理に失敗しました');
setTimeout(() => {
commonStore.clearErrorMessage();
}, 4000);
}
}
Expand Down
13 changes: 6 additions & 7 deletions laravel/app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace App\Providers;

use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
// use App\Auth\AdministratorEloquentUserProvider;
use Laravel\Sanctum\Sanctum;

class AppServiceProvider extends ServiceProvider
Expand All @@ -22,11 +23,9 @@ public function register(): void
*/
public function boot(): void
{
// Auth::provider(
// 'administrator_eloquent_user_provider',
// function ($app, array $config) {
// return new AdministratorEloquentUserProvider($app['hash'], $config['model']);
// }
// );
// 本番環境では強制的にhttps接続
if (App::environment('production')) {
URL::forceScheme('https');
}
}
}

0 comments on commit f833201

Please sign in to comment.