osama_abdullah
2 months ago
331
5
Nova

Default image field is downloading the image with wrong extension when the image is from storage

Posted 2 months ago by osama_abdullah
// #image
OrderImage::make('Image')
	->url('/orders/order/' . optional($this)->image . '/get-preview-image')
	->canSee(function () use ($user) {
		return $user->hasPermission('orders-fields-image-see');
	})
	->hideWhenUpdating(! $user->hasPermission('orders-fields-image-edit'))
	->disk('orderImages')
	->prunable($isNotDefault = optional($this)->image !== 'default.png')
	->deletable(false)
	->acceptedTypes('image/*')
	->rules('required', 'mimes:jpg,jpeg,bmp,png,webp', 'max:3000')

this is the code responsible for displaing the image in view page of the resource and there is a default download link that filed offers provide out of the box, when i press that link or try to save the image it will be saved by (.htm) extention but if u manully change the extention to .png or .jpeg it works fine

how to download it with its original extension as usual?

knowing that I have tried to implement

	->download(function () {
					
	})

countless times returning all possible things

Please sign in or create an account to participate in this conversation.