Bagisto product image broken after upload ?
-
Hello,
I have a fresh installation of Bagisto on my VPS production server,
There is a huge problem in uploading images to any product. When uploading any image, it appears within the admin panel, but totally broken from the front end.
When I check the source code, I found that all images are called from the cache dir, which is not exciting in the public folder or even in storage/app/public dir
Everything is configured correctly, all folders have 755 permissions, and all files have 644 permissions
Image cache has the default configuration, INTL and GD libraries installed# ----------- MAIN APP ROUTES ----------- # Laravel front controller pattern location / { try_files $uri $uri/ /index.php?$query_string; } # ---- PHP Processing Block ---- location ~ \.php$ { fastcgi_pass unix:/run/php/php8.3-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; include fastcgi_params; } # Deny access to .htaccess files location ~ /\.ht { deny all; } # Deny access to hidden files location ~ /\.(?!well-known).* { deny all; } # Deny access to sensitive Laravel files and directories location ~ ^/(app|bootstrap|config|database|resources|routes|tests|vendor)/ { deny all; } location ~* \.(js|css|pdf|html|swf)$ { expires 30d; add_header Cache-Control "public, no-transform"; } # Laravel-specific static file handling location ~* \.(jpg|jpeg|png|gif|ico|svg|webp|mp4|webm)$ { expires 30d; add_header Cache-Control "public, no-transform"; }
The nginx configuration has no problem
<img class="after:content-[' '] relative bg-zinc-100 transition-all duration-300 after:block after:pb-[calc(100%+9px)] group-hover:scale-105" index="11" width="291" height="300" alt="سترة OmniHeat Men's Solid Hooded Puffer Jacket-أزرق-أخضر-L" data-src="https://www.domain.com/cache/medium/product/11/dzEwjTPmDNVDIOZapbvCZI2kmOPjcu8GRZb1udkK.webp" id="image-52" style="display: none;" src="https://www.domain.com/cache/medium/product/11/dzEwjTPmDNVDIOZapbvCZI2kmOPjcu8GRZb1udkK.webp">
This is how the front-end tags call the images
APP_NAME=Olivexy APP_ENV=local APP_KEY=base64:Ujsw3kuUzBhmRnG/BRXExWA9Z6Vra2aDjfHuyswj0f0= APP_DEBUG=true APP_DEBUG_ALLOWED_IPS= APP_URL=https://www.domain.com APP_ADMIN_URL=system APP_TIMEZONE=Africa/Cairo APP_LOCALE=ar APP_FALLBACK_LOCALE=en APP_FAKER_LOCALE=en_US APP_CURRENCY=EGP APP_MAINTENANCE_DRIVER=file # APP_MAINTENANCE_STORE=database BCRYPT_ROUNDS=12 LOG_CHANNEL=stack LOG_STACK=single LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug DB_CONNECTION="mysql" DB_HOST="localhost" DB_PORT="3407" DB_DATABASE="cart" DB_USERNAME="bagiusr" DB_PASSWORD="123456" DB_PREFIX="ol_" SESSION_DRIVER=file SESSION_LIFETIME=120 SESSION_ENCRYPT=false SESSION_PATH=/ SESSION_DOMAIN=null BROADCAST_CONNECTION=log FILESYSTEM_DISK=public QUEUE_CONNECTION=sync CACHE_STORE=file CACHE_PREFIX= MEMCACHED_HOST=127.0.0.1 REDIS_CLIENT=phpredis REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 RESPONSE_CACHE_ENABLED=false MAIL_MAILER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME= MAIL_PASSWORD= MAIL_ENCRYPTION=tls MAIL_FROM_ADDRESS=shop@example.com MAIL_FROM_NAME=Shop ADMIN_MAIL_ADDRESS=admin@example.com ADMIN_MAIL_NAME=Admin
.env Nothing Fancy
any help please ? -
Hello @olivexy
Please try to run the below command in the root of your project.
php artisan storage:link
Then let us know is this issue is resolved or not.
Warm Regards
Team Bagisto -
@Rishabh-Webkul said in Bagisto product image broken after upload ?:
Hello @olivexy
Please try to run the below command in the root of your project.
php artisan storage:link
Then let us know is this issue is resolved or not.
Warm Regards
Team BagistoI did and it give error that storage link created before
I removed old symlink and recreated again nothing still broken -
Hello @olivexy
Can you please share us with the image of your broken image. This will help us to resolve your query.
Warm Regards
Team Bagisto -
@Rishabh-Webkul said in Bagisto product image broken after upload ?:
Can you please share us with the image of your broken image. This will help us to resolve your query.
Warm Regardshi, im facing the same problem about the broken image, i already did the storage link and unlink for many time and it still broken in the front store.. this is the photo of the broken image
this photo is from my front store if the link use cache/medium or another cache
but if the url using /storage the image will show, i need to know what's wrong with this