This repository was archived by the owner on Sep 3, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +14
-14
lines changed
packages/plugins/profile-image/src Expand file tree Collapse file tree 5 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,8 @@ export default async function CommunityPage() {
8686 } ,
8787 {
8888 name : "@better-auth-kit/profile-image" ,
89- description : "Upload, delete, and manage profile pictures for your users." ,
89+ description :
90+ "Upload, delete, and manage profile pictures for your users." ,
9091 downloads : 0 ,
9192 version : "0" ,
9293 docs : "https://better-auth-kit.com/docs/plugins/profile-image" ,
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export default function Page() {
2323 console . log ( "Uploading" , image ) ;
2424
2525 const blob = await compressImage ( image ) ;
26- if ( ! blob ) return ;
26+ if ( ! blob ) return ;
2727
2828 const res = await authClient . profileImage . upload ( {
2929 image : blob ,
@@ -67,8 +67,6 @@ export default function Page() {
6767 ) ;
6868}
6969
70-
71-
7270function UploadProfileImage ( ) {
7371 const [ image , setImage ] = useState < File | null > ( null ) ;
7472
@@ -82,20 +80,19 @@ function UploadProfileImage() {
8280 if ( ! image ) return ;
8381
8482 const blob = await compressImage ( image ) ;
85- if ( ! blob ) return ;
83+ if ( ! blob ) return ;
8684
8785 const { data, error } = await authClient . profileImage . upload ( {
88- image : blob
86+ image : blob ,
8987 } ) ;
9088
91- if ( data ) {
89+ if ( data ) {
9290 console . log ( `Successfully uploaded image to ${ data . image . url } ` ) ;
93- } else {
91+ } else {
9492 console . error ( `Something went wrong:` , error ) ;
9593 }
9694 } ;
9795
98-
9996 return (
10097 < div >
10198 < Label htmlFor = "image-upload" > Upload Image</ Label >
Original file line number Diff line number Diff line change 11import { betterAuth } from "better-auth" ;
22import { nextCookies } from "better-auth/next-js" ;
33import Database from "better-sqlite3" ;
4- import { profileImage , UploadThingProvider } from "@better-auth-kit/profile-image" ;
4+ import {
5+ profileImage ,
6+ UploadThingProvider ,
7+ } from "@better-auth-kit/profile-image" ;
58import { UTApi } from "uploadthing/server" ;
69import "dotenv/config" ;
710
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ export interface ProfileImageOptions {
7777
7878 /**
7979 * Optional array of trusted image origins. If undefined, any origin is trusted.
80- *
80+ *
8181 * @default undefined
8282 */
8383 trustedImageOrigins ?: string [ ] | undefined ;
Original file line number Diff line number Diff line change @@ -52,11 +52,10 @@ export function detectImageFormatFromBase64(
5252 return null ;
5353}
5454
55-
5655export async function detectFileTypeFromBlob ( blob : Blob ) {
5756 const arrayBuffer = await blob . arrayBuffer ( ) ; // convert blob to ArrayBuffer
5857 const uint8Array = new Uint8Array ( arrayBuffer ) ; // required by file-type
59-
58+
6059 const fileType = await fileTypeFromBuffer ( uint8Array ) ;
6160 return fileType ; // returns { ext: "png", mime: "image/png" } or undefined
62- }
61+ }
You can’t perform that action at this time.
0 commit comments