bupy7 / yii2-widget-cropbox

This widget allows crop image before upload to server and send informations about crop in JSON format.
BSD 3-Clause "New" or "Revised" License
91 stars 33 forks source link

Undefined offset: 0 #21

Closed shahzadthathal closed 8 years ago

shahzadthathal commented 8 years ago

I got this issue:

Undefined offset: 0 erro-imag-crp

bupy7 commented 8 years ago

Show me var_dump($this->crop_info);

FedericoBenedetti1976 commented 8 years ago

in my case i had this error when i sumbit my form without cropping the image after the load. What's the better way to avoid it? For now i put hidden submit button and when the user click on crop, i show it using jquery.

bupy7 commented 8 years ago

@Lordfef,

if (!empty($this->crop_info[0])) {
    // crop image
}
FedericoBenedetti1976 commented 8 years ago

thank's @bupy7 i think also your solution, but i think is better to manage it client side before validation. It's possible?

bupy7 commented 8 years ago

@Lordfef add this code in a custom validator

bupy7 commented 8 years ago

The reason for closing: No answer.