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
- Realtime for files() works almost well, ...
I have been trying to make use of realtime, today (14.03.26) I have pulled all the latest versions of docker images, and sdk available. Whats working: - Conn...
- Function issue
Hi,idk whats wrong with my function but i made some changes to the env var and made sure they saved then i redeployed it,but then after it redeeployed it asked ...
- Function issue
Hi,idk whats wrong with my function but i made some changes to the env var and made sure they saved then i redeployed it,but then after it redeeployed it asked ...