Keep ratio
This commit is contained in:
		
					parent
					
						
							
								fc7529822f
							
						
					
				
			
			
				commit
				
					
						96820c5d0f
					
				
			
		
					 1 changed files with 14 additions and 2 deletions
				
			
		|  | @ -251,8 +251,20 @@ class FFMpeg extends Binary | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                      |                      | ||||||
|                     $width = $this->getMultiple($originalWidth, 16); |                     $originalRatio = $originalWidth / $originalHeight; | ||||||
|                     $height = $this->getMultiple($originalHeight, 16); |                      | ||||||
|  |                     $targetRatio = $format->getWidth() / $format->getHeight(); | ||||||
|  |                      | ||||||
|  |                     if($targetRatio >= $originalRatio){ | ||||||
|  |                         $height = $format->getHeight(); | ||||||
|  |                         $width = $format->getHeight() * $originalRatio; | ||||||
|  |                     }else{ | ||||||
|  |                         $width = $format->getWidth(); | ||||||
|  |                         $height = $format->getWidth() / $originalRatio; | ||||||
|  |                     } | ||||||
|  | 
 | ||||||
|  |                     $width = $this->getMultiple($width, 16); | ||||||
|  |                     $height = $this->getMultiple($height, 16); | ||||||
|                     break; |                     break; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue