Autoresize to fit, flags at bottom

This commit is contained in:
Mattia Mascarello 2021-08-24 03:06:10 +02:00 committed by GitHub
parent 7eaf87c793
commit 708427ff93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,18 +1,24 @@
<?php <?php
function flagGetFromUser($p){ function flagGetFromUser($p){
$o = strtoupper($p->orient); $re=[];
if (contains("LESB", $o)) return "lesbian"; $o = strtoupper($p->orient." ".$p->gender);
if (contains("BI", $o)) return "bi"; //orientations, sexual
if (contains("ACE", $o)) return "asex"; if (contains("LESB", $o)) $re[]= "lesbian";
if (contains("ASE", $o)) return "asex"; if (contains("BI", $o)) $re[]="bi";
if (contains("GAY", $o)) return "gay"; if (contains("ACE", $o)) $re[]= "asex";
if (contains("BSX", $o)) return "bi"; if (contains("ASE", $o)) $re[]= "asex";
if (contains("PAN", $o)) return "pan"; if (contains("GAY", $o)) $re[]= "gay";
if (contains("LELL", $o)) return "lesbian"; if (contains("BSX", $o)) $re[]= "bi";
if (contains("OMNI", $o)) return "omni"; if (contains("PAN", $o)) $re[]= "pan";
if (contains("QUEST", $o)) return "questioning"; if (contains("LELL", $o)) $re[]= "lesbian";
if (contains("ETERO", $o) || contains("HET", $o)) return "etero"; if (contains("OMNI", $o)) $re[]= "omni";
return false; if (contains("QUEST", $o)) $re[]= "questioning";
if (contains("ETERO", $o) || contains("HET", $o)) $re[]= "etero";
//orientation, romantic
//gender-related
if(contains("MTF",$o) || contains("FTM",$o) || contains("TRANS",$o)) $re[]="trans";
return $re;
} }
function dlImage($userId,$fileName){ function dlImage($userId,$fileName){
@ -81,7 +87,7 @@ if($id==$GLOBALS["config"]["lgbt"]["devId"]){
list($width, $height) = getimagesize("gdImg/dev.png"); list($width, $height) = getimagesize("gdImg/dev.png");
$hw=150*$height/$width; $hw=150*$height/$width;
if($hw>600){$hw=600;} if($hw>600){$hw=600;}
imagecopyresized($jpg_image, $photo, 800, 0, 0, 0, 500, $hw, $width, $height); imagecopyresized($jpg_image, $photo, 800, 0, 0, 0, 500, $hw, $width, $height+150);
} }
imagettftext($jpg_image, 25, 0, 720, 435, $white, $font_path, $orient); imagettftext($jpg_image, 25, 0, 720, 435, $white, $font_path, $orient);
@ -95,28 +101,29 @@ $hw=500*$height/$width;
if($hw>600){$hw=600;} if($hw>600){$hw=600;}
imagecopyresized($jpg_image, $photo, 10, 100, 0, 0, 500, $hw, $width, $height); imagecopyresized($jpg_image, $photo, 10, 100, 0, 0, 500, $hw, $width, $height);
if($fln){ list($wc, $hc) = getimagesize("gdImg/cid.png");
$flag = imagecreatefrompng("gdImg/flags/".$fln.".png"); $ho=$hc+floor(count($fln)/6)*100;
list($width, $height) = getimagesize("gdImg/flags/".$fln.".png"); $image_out = imagecreatetruecolor($wc,$ho);
$w2 = $width; $bg_color = ImageColorAllocate ($image_out, 0, 0, 0);
//if($hw>600){$hw=600;} imagefill($image_out,0,0,$bg_color);
imagecopyresized($jpg_image, $flag, 10, 0, 0, 0, 200, 100, $width, $height); imagecopy($image_out, $jpg_image, 0, 0, 0, 0, $wc,$hc);
$gender = strtolower($gender); if(count($fln)){
$orient = strtolower($orient); $i=0;
if(contains("mtf",$gender) || contains("ftm",$gender) || contains("trans",$gender) || contains("mtf",$orient) || contains("ftm",$orient) || contains("trans",$orient) ){ foreach($fln as $el){
$flag = imagecreatefrompng("gdImg/flags/trans.png"); $flag = imagecreatefrompng("gdImg/flags/".$el.".png");
list($width, $height) = getimagesize("gdImg/flags/trans.png"); list($width, $height) = getimagesize("gdImg/flags/".$el.".png");
//if($hw>600){$hw=600;}
imagecopyresized($jpg_image, $flag, 200, 0, 0, 0, 200, 100, $width, $height); imagecopyresized($image_out, $flag, 10+200*($i%6), $hc+10+100*floor($i/6), 0, 0 , 200, 100, $width, $height);
$i++;
} }
} }
unlink($dest); unlink($dest);
// Send Image to Browser // Send Image to Browser
imagejpeg($jpg_image,$dest); imagejpeg($image_out,$dest);
// Clear Memory // Clear Memory
imagedestroy($jpg_image); imagedestroy($image_out);
} }
?> ?>