MCPcopy Create free account
hub / github.com/codemistic/Web-Development / image

Method image

text-to-qr/lib/phpqrcode/phpqrcode.php:977–1005  ·  view source on GitHub ↗

----------------------------------------------------------------------

($frame, $pixelPerPoint = 4, $outerFrame = 4)

Source from the content-addressed store, hash-verified

975
976 //----------------------------------------------------------------------
977 private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4)
978 {
979 $h = count($frame);
980 $w = strlen($frame[0]);
981
982 $imgW = $w + 2*$outerFrame;
983 $imgH = $h + 2*$outerFrame;
984
985 $base_image =ImageCreate($imgW, $imgH);
986
987 $col[0] = ImageColorAllocate($base_image,255,255,255);
988 $col[1] = ImageColorAllocate($base_image,0,0,0);
989
990 imagefill($base_image, 0, 0, $col[0]);
991
992 for($y=0; $y<$h; $y++) {
993 for($x=0; $x<$w; $x++) {
994 if ($frame[$y][$x] == '1') {
995 ImageSetPixel($base_image,$x+$outerFrame,$y+$outerFrame,$col[1]);
996 }
997 }
998 }
999
1000 $target_image =ImageCreate($imgW * $pixelPerPoint, $imgH * $pixelPerPoint);
1001 ImageCopyResized($target_image, $base_image, 0, 0, 0, 0, $imgW * $pixelPerPoint, $imgH * $pixelPerPoint, $imgW, $imgH);
1002 ImageDestroy($base_image);
1003
1004 return $target_image;
1005 }
1006 }
1007
1008

Callers 2

pngMethod · 0.95
jpgMethod · 0.95

Calls 1

countFunction · 0.85

Tested by

no test coverage detected