简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM