404

[ Avaa Bypassed ]




Upload:

Command:

botdev@3.139.60.67: ~ $
<?php
class BayaImage{
	public $frameUrl;
	public $frameImage;
	
	function __construct(){
		$this->frameURL = "../classes/quiz/frame.png";
		$this->frameImage = imagecreatefrompng($this->frameURL);
		
	}
	public function createCollage($relatedImages){
		$top = 110;
		$left = 120;
		$i= 0;
		$j = 0;
		
		echo "related images :";
		print_r($relatedImages);
		foreach($relatedImages as $image){
			
			$imageFile = imagecreatefromjpeg($image);
			$newImageFile = $this->resize_image($imageFile,$image, 330, 300, $newHeight,$newWidth);
			imagecopy($this->frameImage, $newImageFile, $left, $top, 0, 0,$newWidth, $newHeight);
			$j++;
			imagedestroy($newImageFile);
			
			if(($j%2)==0) {
				$left = 120;
				$top += $newHeight +10;
			}
			else {
				$left =460;
			}
		}
		$randNum = rand(100000,999999);
		imagejpeg($this->frameImage,"../classes/quiz/images/image$randNum.jpg");
		imagedestroy($this->frameImage);
		return "image$randNum.jpg";
		
	}
	public function resize_image($imageFile,$imageUrl, $w, $h, &$newheight, &$newwidth) {
		list($width, $height) = getimagesize($imageUrl);
		$r = $width / $height;

			if ($w/$h > $r) {
				$newwidth = $h*$r;
				$newheight = $h;
			} else {
				$newheight = $w/$r;
				$newwidth = $w;
			}
		
		$resizedImageFile = imagecreatetruecolor($newwidth, $newheight);
		imagecopyresampled($resizedImageFile, $imageFile, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
		return $resizedImageFile;
	}
	
	
}

Filemanager

Name Type Size Permission Actions
BayaImage.php File 1.48 KB 0644
QuizDatabaseHandler.php File 24.55 KB 0644
QuizMaker.php File 17.53 KB 0644
first.jpg File 95.66 KB 0644
frame - Kopie.png File 559.68 KB 0644
frame.png File 559.68 KB 0644