J_shelfwood's avatar

Uploaded image is rotated when uploaded via mobile

I have this really weird issue where if one of my clients uploads an image from his phone it gets rotated.

I've done some research and stumbled upon a few threads mentioning some data that needs to be read from the image. I currently save the image like this:

public function store(StoreImageRequest $request)
    {
        $image = Image::create([
            'user_id' => auth()->id(),
            'attachable_id' => $request->attachable_id,
            'attachable_type' => $request->attachable_type,
            'path' => $request->file('image')->store('images', 'public'),
            'title' => $request->title,
        ]);

        return $this->setItem($image)->respond();
    }

What I need to do is check the image to see if that data is available and then rotate it depending on that. Does anyone have any experience with this kind of issue? I can't seem to find a simple solution to this problem myself.

0 likes
1 reply

Please or to participate in this conversation.