Eventviva\ImageResize::getSourceWidth PHP Method

getSourceWidth() public method

Gets source width
public getSourceWidth ( ) : integer
return integer
    public function getSourceWidth()
    {
        return $this->original_w;
    }

Usage Example

Example #1
0
 public function uploadFile()
 {
     $this->filename = $this->file->baseName . '.' . $this->file->extension;
     $this->avatar = Yii::$app->security->generateRandomString() . '.' . $this->file->extension;
     $this->type = $this->file->type;
     if ($this->validate()) {
         $this->save(false);
         $filePath = Yii::$app->params['imagePath'] . $this->avatar;
         $image = new ImageResize($this->file->tempName);
         if ($image->getSourceWidth() > 1200) {
             $image->resizeToWidth(1200)->save($filePath);
         } else {
             $this->file->saveAs($filePath);
         }
         return true;
     }
     return false;
 }
All Usage Examples Of Eventviva\ImageResize::getSourceWidth