Kinty1931
Kinty1931

Reputation: 11

Can't write image data to path

I already upload my image in my image directory.Now after uploading when i show my image list then there have a button when any one click that button then image will be resize and save into another folder.

I am using Intervention Image to resize an save.

My code is:

Image::make(asset($get_data->front_image))
->resize(960, 960)->save('public/product_image_home_thumbs)

asset($get_data->front_image) means http://example.com/product_image/saree.jpg

But Its return a error

Can't write image data to path (public/product_image_home_thumbs)

My product_image_home_thumbs have 777 permission.

I cant understand. whats wrong

Upvotes: 0

Views: 1024

Answers (2)

Doom5
Doom5

Reputation: 858

You need to specify the filename too:

Image::make(asset($get_data->front_image))
    ->resize(960, 960)
    ->save('public/product_image_home_thumbs/[image_name].[image_extension]);

Replace [image_name] and [image_extension] with the name and extension you want the image to be encoded to.

Upvotes: 0

Matovidlo
Matovidlo

Reputation: 46

Do you have it correctly ended? i see there is not apostrophe at the and and pracket is not closed. Maybe try to use full path. Check current directory where you have code in shell by command, sample output

pwd
/name_of_folder/../file.php

Upvotes: 0

Related Questions