#108935 Исследовать вопрос с поддержкой альфа-канала при сохранении png-изображений стикеров
This commit is contained in:
		
							
								
								
									
										6
									
								
								File.php
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								File.php
									
									
									
									
									
								
							@@ -178,9 +178,9 @@ class File extends \yii\db\ActiveRecord
 | 
			
		||||
            $this->ext = $this->file->extension;
 | 
			
		||||
            $this->md5 = md5_file($this->file->tempName);
 | 
			
		||||
            $patch = $this->getDir(true);
 | 
			
		||||
            if ($this->isImage && $this->ext != 'jpg') //не конвертируем изображение в jpg если оно уже jpg
 | 
			
		||||
            if ($this->isImage && $this->ext != 'jpg' && $this->convertJpg) //не конвертируем изображение в jpg если оно уже jpg
 | 
			
		||||
            {
 | 
			
		||||
                $this->ext = $this->convertJpg ? 'jpg' : $this->ext;
 | 
			
		||||
                $this->ext = 'jpg';
 | 
			
		||||
                $this->name = $this->getFileName();
 | 
			
		||||
                $fileName = $this->name . '.' . $this->ext;
 | 
			
		||||
 | 
			
		||||
@@ -414,7 +414,7 @@ class File extends \yii\db\ActiveRecord
 | 
			
		||||
     */
 | 
			
		||||
    protected function deleteBorder($filePatch)
 | 
			
		||||
    {
 | 
			
		||||
        $img = imagecreatefromjpeg($filePatch);
 | 
			
		||||
        $img = $this->ext == 'jpg' ? imagecreatefromjpeg($filePatch) : imagecreatefrompng($filePatch);
 | 
			
		||||
 | 
			
		||||
        $this->width = $this->width > 0 ? $this->width : imagesx($img);
 | 
			
		||||
        $this->height = $this->height > 0 ? $this->height : imagesy($img);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user