Laravel R2 Profile Image Uploader
Budget: ₹600 – ₹1,500 INR
I have a Laravel application that stores user information and I now want to off-load profile pictures to Cloudflare R2. The upload flow will be API-driven: a client app will hit an endpoint in my project, send the picture, and receive back the final public URL.
Here is exactly what I need done:
• Build or extend an API route in Laravel that accepts a single profile picture per request, validates size/type, and streams it to my Cloudflare R2 bucket.
• On the fly, apply automatic resizing (max width/height 512 px is fine) and lossless/lossy compression so the file size remains small without noticeable quality loss. Intervention Image, Spatie Image, or a similar package is fine—use whatever integrates cleanly.
• Return a signed or public URL (depending on best practice) so the front end can display the avatar immediately.
• Store the R2 object key in my existing users table; no schema change is required, there’s already a nullable column for it.
• Provide concise setup notes so I can move the solution between staging and production buckets without surprises.
Acceptance criteria
1. Successful POST to /api/avatar with an image returns 201 and JSON containing the permanent image URL.
2. Uploaded file is resized and compressed, confirmed by checking dimensions and file size.
3. File is present in the specified R2 bucket and accessible via the returned URL.
4. Code follows Laravel best practices (service class, config driven keys, .env usage).
Let me know the estimated turnaround and any additional information you need about my current codebase or Cloudflare credentials.
Here is exactly what I need done:
• Build or extend an API route in Laravel that accepts a single profile picture per request, validates size/type, and streams it to my Cloudflare R2 bucket.
• On the fly, apply automatic resizing (max width/height 512 px is fine) and lossless/lossy compression so the file size remains small without noticeable quality loss. Intervention Image, Spatie Image, or a similar package is fine—use whatever integrates cleanly.
• Return a signed or public URL (depending on best practice) so the front end can display the avatar immediately.
• Store the R2 object key in my existing users table; no schema change is required, there’s already a nullable column for it.
• Provide concise setup notes so I can move the solution between staging and production buckets without surprises.
Acceptance criteria
1. Successful POST to /api/avatar with an image returns 201 and JSON containing the permanent image URL.
2. Uploaded file is resized and compressed, confirmed by checking dimensions and file size.
3. File is present in the specified R2 bucket and accessible via the returned URL.
4. Code follows Laravel best practices (service class, config driven keys, .env usage).
Let me know the estimated turnaround and any additional information you need about my current codebase or Cloudflare credentials.
Related categories:
PHP
MySQL
HTML
Laravel
Image Processing
Web Development
API Development
Cloudflare