public function thumb($width, $height=null, $imageObj = null, array $options = [])
    {
        // get current  object's image in case there is no specific image given
        if(!$imageObj) {
            $imageObj = $this;
        }
        $thumbDirectory =  $width.($height ? 'x'.$height : "");
        $thumbPath = $imageObj->fileDirectory.'/'.$thumbDirectory.'/'.$imageObj->filename;
        $thumbUrl = null;

        if(file_exists(base_path($thumbPath))) {
            $thumbUrl = asset($thumbPath);
        }else{
            if($this->createThumb($imageObj, $width, $height, $options)) {
                $thumbUrl = asset($thumbPath);
            }
        }

        return ($thumbUrl) ? $thumbUrl . "?" .strtotime($imageObj->updated_at) : null;
    }
public function thumb($width, $height=null, $imageObj = null, array $options = [])
    {
        // get current  object's image in case there is no specific image given
        if(!$imageObj) {
            $imageObj = $this;
        }
        $thumbDirectory =  $width.($height ? 'x'.$height : "");
        $thumbPath = $imageObj->fileDirectory.'/'.$thumbDirectory.'/'.$imageObj->filename;
        $thumbUrl = null;

        if(file_exists(base_path($thumbPath))) {
            $thumbUrl = asset($thumbPath);
        }else{
            if($this->createThumb($imageObj, $width, $height, $options)) {
                $thumbUrl = asset($thumbPath);
            }
        }

        return ($thumbUrl) ? $thumbUrl . "?" .strtotime($imageObj->updated_at) : null;
    }
public function thumb ( $ width , $ height = null , $ imageObj = null , array $ options = [ ] ) { // get current  object's image in case there is no specific image given if ( ! $ imageObj ) { $ imageObj = $ this ; } $ thumbDirectory = $ width . ( $ height ? 'x' . $ height : "" ) ; $ thumbPath = $ imageObj -> fileDirectory . '/' . $ thumbDirectory . '/' . $ imageObj -> filename ; $ thumbUrl = null ; if ( file_exists ( base_path ( $ thumbPath ) ) ) { $ thumbUrl = asset ( $ thumbPath ) ; } else { if ( $ this -> createThumb ( $ imageObj , $ width , $ height , $ options ) ) { $ thumbUrl = asset ( $ thumbPath ) ; } } return ( $ thumbUrl ) ? $ thumbUrl . "?" . strtotime ( $ imageObj -> updated_at ) : null ; }
Get thumb by image and size.
If requested thumb does not exist, it automatically creates it.

@param  int   $width
@param  int   $height
@param  int   $imageObj
@param  array $options
@return null|string Returns URL of thumb, null if thumb could not found or created

@throws \Exception
Get thumb by image and size . If requested thumb does not exist it automatically creates it .