martzer's avatar

Can't display a jpeg photo

Hello, I've a problem and i can't find a way to fix it. I do have my laravel project in local, that can be access in local (127.0.0.1:8000) and my project on production is on my server. They are the same, expect that the .env , but they are both based on my gitlab project. In localhost, i do have no problem with photo, i can upload photo, remove them or change them from my jetstream profile. But when its online, whenever i'm still able to upload photo, i cannot upload .jpeg file. It says "The photo must be an image". How can i fix this ? It seems that i need to allow "jpeg" files, but I couldnt fix it ...

Any ideas ?

0 likes
7 replies
Nakov's avatar

@martzer have you tried adding these as validation rules 'required|image|mimes:jpeg,png,jpg,gif'?

Or try another jpeg file and make sure the extension on the one you are trying is not broken.

1 like
martzer's avatar

Where can I add those validation rules ? in Actions/Fortify/UpdateUserProfileInformation.php ?

By the way, i did try a jpg too, it doesnt work. But png work .. i really dont get it.

Nakov's avatar

Yes, in that file replace this line:

'photo' => ['nullable', 'image', 'max:1024'],

with

'photo' => ['nullable', 'image', 'max:1024', 'mimes:jpeg,png,jpg,gif'],
1 like
martzer's avatar

I added the mimes rules, still change nothing, i keep have the error validation message "This photo must be an image"

Nakov's avatar

Try removing the image rule and just use the mimes?

1 like
martzer's avatar

Nice, it works, it finally upload my jpeg pictures, and display it. Thanks a lot for your time

Nakov's avatar

You can select the answer as "Best Answer" it might help others too. Have a great day :)

Please or to participate in this conversation.