Imagine attending an exciting event — like a developer conference—where you meet new people, take tons of photos and vidoes with them, and make lasting memories. But once the event wraps up, you realize you have no easy way to get all those great pictures.
Or consider a wedding ceremony: You know your guests captured beautiful moments throughout the day, but gathering all those photos means individually reaching out to each person. It is definitely not the way to go.
Picshaw offers a simple solution. As an event organizer, you can create a dedicated event folder on the platform, generate a shareable link, and invite your guests to upload the pictures they’ve taken. This way, everyone gets to relive the event from the unique perspectives of all attendees. No more missing moments, just memories shared effortlessly.
Picshaw Features
Creating Public and Private events.
Public events are showcased on the “Discover Events” page, allowing anyone to browse and explore them. Private events, on the other hand, remain accessible only via a shareable link provided by the event organizer.
Upload Files Effortlessly
Guests can easily upload their event photos to the designated event folder, making sure all memorable moments are gathered in one place.
Browse Uploaded Photos with Two Viewing Modes.
Users can explore photos either in list mode, which snaps images into a feed similar to Instagram, or in grid mode, offering a gallery-style layout.
Easily Share Event Links
Organizers can generate and share a unique link to invite guests to upload their pictures, streamlining the process of gathering photos.
Discover Public Events
Explore and browse all public events from the “Discover Events” page, opening up new ways to experience moments shared by others.
Seamless Authentication
Users can sign in quickly and securely using Google sign-in or magic links, making the experience smooth and hassle-free.
Ensured my user was logged in:
I ensured the user was logged in before uploading.
constsession=awaitauth()if (!session||!session.user){returnrespondError(newError("User not authenticated"),"Failed to authenticate user",401)}
Validate the Request:
I checked if the event exists and ensured the file upload is within limits.
constform=awaitrequest.formData()constfiles=Array.from(form.values())consteventSlug=params["event-slug"]try{constevent=awaitprisma.event.findUnique({where:{slug:eventSlug}})if (!event){returnrespondError(newError("Event not found"),undefined,404)}if (files.length>50){returnrespondError(newError("Limit of 50 files per request"),"Too many files",400)}elseif (files.length===0){returnrespondError(newError("At least one file is required"),"No files",400)}
Upload files to Pinata
The next step is uploading the files.
Note: A better implementation would include checks for failed uploads. This way, users are notified about failed files and can retry uploading them.
Save Upload Data to the Database
Finally, I saved the upload information into the database using Prisma.
constdbUpload=awaitprisma.upload.create({data:{text:`${session.user.name} uploaded ${files.length} images for ${event?.name}`,ownerId:session.user?.id??"",eventId:event?.id??"",files:{createMany:{data:uploadsWithPublicURL.map(file=>{return{ownerId:session.user?.id??"",eventId:event?.id??"",cid:file.id,publicURL:file.publicURL,}})}}}})returnrespondSuccess(dbUpload,"Uploaded successfully",201)
This flow ensures the event photos are uploaded securely and efficiently to Pinata, with successful uploads tracked and stored in the database for easy access later.
Rendering the uploaded images in the browser
1. Updating next.config.js
I first had to update the images field in the next.config.js file to allow NextJS optimize images from remote URLs.
To further improve the app, it would be necessary to add some content moderation features. This would ensure that users don't post NSFW content on public groups. I started integrating with Google Cloud Vision but I didn't have enough time to complete it before the deadline.
Conclusion
Integrating Pinata’s Files API into Picshaw has greatly enhanced how images are uploaded and managed. Pinata provided seamless performance, and its intuitive API made implementation straightforward, allowing me to focus on building the core features of the app while trusting Pinata to handle file storage and delivery efficiently.
Overall, Pinata has been an essential tool in building a reliable and smooth image management system for Picshaw.