path = $UserRequest->parse(); $this->exec(); } private function exec() { // Look for image on source folder $image_path = $this->imageSearch(); // Image process $image = New Image($image_path); // Source Image Dimensions $image->imageDimensions(); // Resize base on user params $new_dimensions = $image->imageAspectRatio($this->path); // Show image $image->show($new_dimensions); } private function imageSearch() { if( isset($this->path['width']) && in_array($this->path['width'],$this->folders) && file_exists($image = "source/{$this->path['width']}/{$this->path['imageName']}") ) { return $image; } else { if(file_exists($image = "source/default/{$this->path['imageName']}")) { return $image; } } } } $main = New Main($_GET['data']);