Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

thomasssss's avatar

Possibilities to modify Spark's built in cropper for team image's

Is it possible to customize Spark's built in image cropper to modify the cropped size without changing Spark's core components? Because Spark is now cropping every uploaded team image to an 300px square image. I already tried the Spark::swap method to modify the TeamPhotoController, but it's not possible to intercept an controller? Instead I need to use one of Spark's built in handle-method's. But there isn't any handle-method available for the TeamPhotoController like there is for the PhotoController (UpdateProfilePhoto).

TeamPhotoController code I want to modify:


    /**
     * Format the given file into a resized image.
     *
     * @param  \Symfony\Component\HttpFoundation\File\UploadedFile  $file
     * @return string
     */
    protected function toImage($file)
    {
        return (string) $this->images->make($file->path())
                            ->fit(300)->encode();
    }

0 likes
2 replies
jmny's avatar
jmny
Best Answer
Level 9

I believe in the latest release they made the photo handlers consistent.

2 likes
thomasssss's avatar

@jmny You're right. The handler is indeed added in the latest Spark release (3.0.4). Thank you putting me in the right direction.

Please or to participate in this conversation.