what are permissions on the file and bucket?
file permissions are delete for the owner
bucket permissions are create and read for all users
const bucketId = process.env.EXPO_PUBLIC_BUCKET_ID!;
const renderPost = ({ item }: { item: Post }) => {
const imageUrl = appwrite.getFilePreview(bucketId, item.fileId).toString();
console.log(imageUrl);
return (
<TouchableOpacity
onPress={() => {
router.push({
pathname: '/profileFlatList',
params: { selectedPostId: item.$id },
});
}}
className="w-1/3"
>
<Image
source={{
uri: imageUrl,
headers: { Accept: 'image/*' },
}}
className="h-32"
/>
</TouchableOpacity>
);
};
getFilePreview(bucketId: string, fileId: string): URL {
try {
const previewUrl = this.storage.getFilePreview(bucketId, fileId);
const urlWithParams = new URL(previewUrl.toString());
urlWithParams.searchParams.append('mode', 'admin');
return urlWithParams;
} catch (error) {
console.error('Appwrite service :: getFilePreview() :: ', error);
throw error;
}
}
images not hosted on appwrite are rendering
only the filepreview ones are throwing 404
even with hard-coding the url same issue, appwrite hosted images are giving 404
Recommended threads
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...
- Custom emails
What happen if I use a third party email provider to customize my emails and my plan run out of emails/month? Appwrite emails are used as fallback sending emai...