示例#1
0
文件: Line.php 项目: pyrsmk/imagix
 public function apply($resource)
 {
     // Extract arguments
     @(list(, $x1, $y1, $x2, $y2, $thickness, $color) = func_get_args());
     $x1 = (int) $x1;
     $y1 = (int) $y1;
     $x2 = (int) $x2;
     $y2 = (int) $y2;
     $thickness = (int) $thickness;
     if (!$color) {
         $color = '#000000';
     }
     $rgb = html2rgb($color);
     if ($thickness < 1) {
         $thickness = 1;
     }
     // Draw line
     if (!imagesetthickness($resource, $thickness)) {
         throw new Exception("Thickness line changing failed");
     }
     if (!imageline($resource, $x1, $y1, $x2, $y2, imagecolorallocate($resource, $rgb[0], $rgb[1], $rgb[2]))) {
         throw new Exception("Line drawing failed");
     }
     return $resource;
 }
示例#2
0
文件: Rotate.php 项目: pyrsmk/imagix
 public function apply($resource)
 {
     // Verify support
     if (!function_exists('imagerotate')) {
         throw new Exception("It seems your PHP version is not compiled with the bundled version of the GD library");
     }
     // Get arguments
     @(list(, $angle, $color) = func_get_args());
     $angle = (double) $angle;
     if (!$color) {
         $color = '#FFFFFF';
     }
     $rgb = html2rgb($color);
     // Apply effect
     $resource = imagerotate($resource, $angle, imagecolorallocate($resource, $rgb[0], $rgb[1], $rgb[2]));
     if (!$resource) {
         throw new Exception("Image rotation failed");
     }
     return $resource;
 }
示例#3
0
function colorNamer($color)
{
    $colors = array("cloudy blue" => array(172, 194, 217), "dark pastel green" => array(86, 174, 87), "dust" => array(178, 153, 110), "electric lime" => array(168, 255, 4), "fresh green" => array(105, 216, 79), "light eggplant" => array(137, 69, 133), "nasty green" => array(112, 178, 63), "really light blue" => array(212, 255, 255), "tea" => array(101, 171, 124), "red purple" => array(149, 46, 143), "yellow tan" => array(252, 252, 129), "cement" => array(165, 163, 145), "dark grass green" => array(56, 128, 4), "dusty teal" => array(76, 144, 133), "grey teal" => array(94, 155, 138), "mac n cheese" => array(239, 180, 53), "pinkish tan" => array(217, 155, 130), "spruce" => array(10, 95, 56), "strong blue" => array(12, 6, 247), "toxic green" => array(97, 222, 42), "windows blue" => array(55, 120, 191), "vivid blue" => array(34, 66, 199), "blue with a hint of purple" => array(83, 60, 198), "booger" => array(155, 181, 60), "bright sea green" => array(5, 255, 166), "dark green blue" => array(31, 99, 87), "deep turquoise" => array(1, 115, 116), "green teal" => array(12, 181, 119), "strong independent female character pink" => array(255, 7, 137), "bland" => array(175, 168, 139), "deep aqua" => array(8, 120, 127), "lavender pink" => array(221, 133, 215), "light moss green" => array(166, 200, 117), "light seafoam green" => array(167, 255, 181), "olive yellow" => array(194, 183, 9), "pig pink" => array(231, 142, 165), "deep lilac" => array(150, 110, 189), "desert" => array(204, 173, 96), "dusty lavender" => array(172, 134, 168), "purply grey" => array(148, 126, 148), "purply" => array(152, 63, 178), "candy pink" => array(255, 99, 233), "light pastel green" => array(178, 251, 165), "boring green" => array(99, 179, 101), "kiwi green" => array(142, 229, 63), "light grey green" => array(183, 225, 161), "orange pink" => array(255, 111, 82), "tea green" => array(189, 248, 163), "very light brown" => array(211, 182, 131), "egg shell" => array(255, 252, 196), "eggplant purple" => array(67, 5, 65), "powder pink" => array(255, 178, 208), "reddish grey" => array(153, 117, 112), "baby shit brown" => array(173, 144, 13), "liliac" => array(196, 142, 253), "stormy blue" => array(80, 123, 156), "ugly brown" => array(125, 113, 3), "custard" => array(255, 253, 120), "darkish pink" => array(218, 70, 125), "deep brown" => array(65, 2, 0), "greenish beige" => array(201, 209, 121), "manilla" => array(255, 250, 134), "off blue" => array(86, 132, 174), "battleship grey" => array(107, 124, 133), "browny green" => array(111, 108, 10), "bruise" => array(126, 64, 113), "kelley green" => array(0, 147, 55), "sickly yellow" => array(208, 228, 41), "sunny yellow" => array(255, 249, 23), "azul" => array(29, 93, 236), "darkgreen" => array(5, 73, 7), "lichen" => array(143, 182, 123), "light light green" => array(200, 255, 176), "pale gold" => array(253, 222, 108), "sun yellow" => array(255, 223, 34), "tan green" => array(169, 190, 112), "burple" => array(104, 50, 227), "butterscotch" => array(253, 177, 71), "toupe" => array(199, 172, 125), "dark cream" => array(255, 243, 154), "indian red" => array(133, 14, 4), "light lavendar" => array(239, 192, 254), "poison green" => array(64, 253, 20), "puke" => array(182, 196, 6), "bright yellow green" => array(157, 255, 0), "charcoal grey" => array(60, 65, 66), "squash" => array(242, 171, 21), "cinnamon" => array(172, 79, 6), "light pea green" => array(196, 254, 130), "radioactive green" => array(44, 250, 31), "raw sienna" => array(154, 98, 0), "baby purple" => array(202, 155, 247), "cocoa" => array(135, 95, 66), "light royal blue" => array(58, 46, 254), "orangeish" => array(253, 141, 73), "rust brown" => array(139, 49, 3), "sand brown" => array(203, 165, 96), "swamp" => array(105, 131, 57), "tealish green" => array(12, 220, 115), "burnt siena" => array(183, 82, 3), "camo" => array(127, 143, 78), "dusk blue" => array(38, 83, 141), "fern" => array(99, 169, 80), "old rose" => array(200, 127, 137), "pale light green" => array(177, 252, 153), "peachy pink" => array(255, 154, 138), "rosy pink" => array(246, 104, 142), "light bluish green" => array(118, 253, 168), "light bright green" => array(83, 254, 92), "light neon green" => array(78, 253, 84), "light seafoam" => array(160, 254, 191), "tiffany blue" => array(123, 242, 218), "washed out green" => array(188, 245, 166), "browny orange" => array(202, 107, 2), "nice blue" => array(16, 122, 176), "sapphire" => array(33, 56, 171), "greyish teal" => array(113, 159, 145), "orangey yellow" => array(253, 185, 21), "parchment" => array(254, 252, 175), "straw" => array(252, 246, 121), "very dark brown" => array(29, 2, 0), "terracota" => array(203, 104, 67), "ugly blue" => array(49, 102, 138), "clear blue" => array(36, 122, 253), "creme" => array(255, 255, 182), "foam green" => array(144, 253, 169), "light gold" => array(253, 220, 92), "seafoam blue" => array(120, 209, 182), "topaz" => array(19, 187, 175), "violet pink" => array(251, 95, 252), "wintergreen" => array(32, 249, 134), "yellow tan" => array(255, 227, 110), "dark fuchsia" => array(157, 7, 89), "indigo blue" => array(58, 24, 177), "light yellowish green" => array(194, 255, 137), "pale magenta" => array(215, 103, 173), "rich purple" => array(114, 0, 88), "sunflower yellow" => array(255, 218, 3), "leather" => array(172, 116, 52), "racing green" => array(1, 70, 0), "vivid purple" => array(153, 0, 250), "dark royal blue" => array(2, 6, 111), "hazel" => array(142, 118, 24), "muted pink" => array(209, 118, 143), "booger green" => array(150, 180, 3), "canary" => array(253, 255, 99), "cool grey" => array(149, 163, 166), "dark taupe" => array(127, 104, 78), "darkish purple" => array(117, 25, 115), "true green" => array(8, 148, 4), "coral pink" => array(255, 97, 99), "dark sage" => array(89, 133, 86), "dark slate blue" => array(33, 71, 97), "flat blue" => array(60, 115, 168), "mushroom" => array(186, 158, 136), "rich blue" => array(2, 27, 249), "dirty purple" => array(115, 74, 101), "greenblue" => array(35, 196, 139), "icky green" => array(143, 174, 34), "light khaki" => array(230, 242, 162), "warm blue" => array(75, 87, 219), "dark hot pink" => array(217, 1, 102), "deep sea blue" => array(1, 84, 130), "carmine" => array(157, 2, 22), "dark yellow green" => array(114, 143, 2), "pale peach" => array(255, 229, 173), "plum purple" => array(78, 5, 80), "golden rod" => array(249, 188, 8), "neon red" => array(255, 7, 58), "old pink" => array(199, 121, 134), "very pale blue" => array(214, 255, 254), "blood orange" => array(254, 75, 3), "grapefruit" => array(253, 89, 86), "sand yellow" => array(252, 225, 102), "clay brown" => array(178, 113, 61), "dark blue grey" => array(31, 59, 77), "flat green" => array(105, 157, 76), "light green blue" => array(86, 252, 162), "warm pink" => array(251, 85, 129), "dodger blue" => array(62, 130, 252), "gross green" => array(160, 191, 22), "ice" => array(214, 255, 250), "metallic blue" => array(79, 115, 142), "pale salmon" => array(255, 177, 154), "sap green" => array(92, 139, 21), "algae" => array(84, 172, 104), "bluey grey" => array(137, 160, 176), "greeny grey" => array(126, 160, 122), "highlighter green" => array(27, 252, 6), "light light blue" => array(202, 255, 251), "light mint" => array(182, 255, 187), "raw umber" => array(167, 94, 9), "vivid blue" => array(21, 46, 255), "deep lavender" => array(141, 94, 183), "dull teal" => array(95, 158, 143), "light greenish blue" => array(99, 247, 180), "mud green" => array(96, 102, 2), "pinky" => array(252, 134, 170), "red wine" => array(140, 0, 52), "shit green" => array(117, 128, 0), "tan brown" => array(171, 126, 76), "darkblue" => array(3, 7, 100), "rosa" => array(254, 134, 164), "lipstick" => array(213, 23, 78), "pale mauve" => array(254, 208, 252), "claret" => array(104, 0, 24), "dandelion" => array(254, 223, 8), "orangered" => array(254, 66, 15), "poop green" => array(111, 124, 0), "ruby" => array(202, 1, 71), "dark" => array(27, 36, 49), "greenish turquoise" => array(0, 251, 176), "pastel red" => array(219, 88, 86), "piss yellow" => array(221, 214, 24), "bright cyan" => array(65, 253, 254), "dark coral" => array(207, 82, 78), "algae green" => array(33, 195, 111), "darkish red" => array(169, 3, 8), "reddy brown" => array(110, 16, 5), "blush pink" => array(254, 130, 140), "camouflage green" => array(75, 97, 19), "lawn green" => array(77, 164, 9), "putty" => array(190, 174, 138), "vibrant blue" => array(3, 57, 248), "dark sand" => array(168, 143, 89), "saffron" => array(254, 178, 9), "twilight" => array(78, 81, 139), "warm brown" => array(150, 78, 2), "bluegrey" => array(133, 163, 178), "bubble gum pink" => array(255, 105, 175), "duck egg blue" => array(195, 251, 244), "greenish cyan" => array(42, 254, 183), "petrol" => array(0, 95, 106), "royal" => array(12, 23, 147), "butter" => array(255, 255, 129), "dusty orange" => array(240, 131, 58), "off yellow" => array(241, 243, 63), "pale olive green" => array(177, 210, 123), "orangish" => array(252, 130, 74), "leaf" => array(113, 170, 52), "light blue grey" => array(183, 201, 226), "dried blood" => array(75, 1, 1), "lightish purple" => array(165, 82, 230), "rusty red" => array(175, 47, 13), "lavender blue" => array(139, 136, 248), "light grass green" => array(154, 247, 100), "light mint green" => array(166, 251, 178), "sunflower" => array(255, 197, 18), "velvet" => array(117, 8, 81), "brick orange" => array(193, 74, 9), "lightish red" => array(254, 47, 74), "pure blue" => array(2, 3, 226), "twilight blue" => array(10, 67, 122), "violet red" => array(165, 0, 85), "yellowy brown" => array(174, 139, 12), "carnation" => array(253, 121, 143), "muddy yellow" => array(191, 172, 5), "dark seafoam green" => array(62, 175, 118), "deep rose" => array(199, 71, 103), "dusty red" => array(185, 72, 78), "lemon lime" => array(191, 254, 40), "brown yellow" => array(178, 151, 5), "purple brown" => array(103, 58, 63), "wisteria" => array(168, 125, 194), "banana yellow" => array(250, 254, 75), "lipstick red" => array(192, 2, 47), "water blue" => array(14, 135, 204), "brown grey" => array(141, 132, 104), "vibrant purple" => array(173, 3, 222), "baby green" => array(140, 255, 158), "barf green" => array(148, 172, 2), "eggshell blue" => array(196, 255, 247), "sandy yellow" => array(253, 238, 115), "cool green" => array(51, 184, 100), "pale" => array(255, 249, 208), "hot magenta" => array(245, 4, 201), "greyblue" => array(119, 161, 181), "purpley" => array(135, 86, 228), "baby shit green" => array(136, 151, 23), "brownish pink" => array(194, 126, 121), "dark aquamarine" => array(1, 115, 113), "diarrhea" => array(159, 131, 3), "light mustard" => array(247, 213, 96), "pale sky blue" => array(189, 246, 254), "turtle green" => array(117, 184, 79), "bright olive" => array(156, 187, 4), "dark grey blue" => array(41, 70, 91), "greeny brown" => array(105, 96, 6), "lemon green" => array(173, 248, 2), "light periwinkle" => array(193, 198, 252), "seaweed green" => array(53, 173, 107), "sunshine yellow" => array(255, 253, 55), "ugly purple" => array(164, 66, 160), "medium pink" => array(243, 97, 150), "puke brown" => array(148, 119, 6), "very light pink" => array(255, 244, 242), "viridian" => array(30, 145, 103), "bile" => array(181, 195, 6), "faded yellow" => array(254, 255, 127), "very pale green" => array(207, 253, 188), "vibrant green" => array(10, 221, 8), "bright lime" => array(135, 253, 5), "spearmint" => array(30, 248, 118), "light aquamarine" => array(123, 253, 199), "light sage" => array(188, 236, 172), "yellowgreen" => array(187, 249, 15), "baby poo" => array(171, 144, 4), "dark seafoam" => array(31, 181, 122), "deep teal" => array(0, 85, 90), "heather" => array(164, 132, 172), "rust orange" => array(196, 85, 8), "dirty blue" => array(63, 130, 157), "fern green" => array(84, 141, 68), "bright lilac" => array(201, 94, 251), "weird green" => array(58, 229, 127), "peacock blue" => array(1, 103, 149), "avocado green" => array(135, 169, 34), "faded orange" => array(240, 148, 77), "grape purple" => array(93, 20, 81), "hot green" => array(37, 255, 41), "lime yellow" => array(208, 254, 29), "mango" => array(255, 166, 43), "shamrock" => array(1, 180, 76), "bubblegum" => array(255, 108, 181), "purplish brown" => array(107, 66, 71), "vomit yellow" => array(199, 193, 12), "pale cyan" => array(183, 255, 250), "key lime" => array(174, 255, 110), "tomato red" => array(236, 45, 1), "lightgreen" => array(118, 255, 123), "merlot" => array(115, 0, 57), "night blue" => array(4, 3, 72), "purpleish pink" => array(223, 78, 200), "apple" => array(110, 203, 60), "baby poop green" => array(143, 152, 5), "green apple" => array(94, 220, 31), "heliotrope" => array(217, 79, 245), "darker than black" => array(7, 13, 13), "cool blue" => array(73, 132, 184), "leafy green" => array(81, 183, 59), "mustard brown" => array(172, 126, 4), "dusk" => array(78, 84, 129), "dull brown" => array(135, 110, 75), "frog green" => array(88, 188, 8), "vivid green" => array(47, 239, 16), "bright light green" => array(45, 254, 84), "fluro green" => array(10, 255, 2), "kiwi" => array(156, 239, 67), "seaweed" => array(24, 209, 123), "navy green" => array(53, 83, 10), "ultramarine blue" => array(24, 5, 219), "iris" => array(98, 88, 196), "pastel orange" => array(255, 150, 79), "yellowish orange" => array(255, 171, 15), "perrywinkle" => array(143, 140, 231), "tealish" => array(36, 188, 168), "dark plum" => array(63, 1, 44), "pear" => array(203, 248, 95), "pinkish orange" => array(255, 114, 76), "midnight purple" => array(40, 1, 55), "light urple" => array(179, 111, 246), "dark mint" => array(72, 192, 114), "greenish tan" => array(188, 203, 122), "light ron burgundy" => array(168, 65, 91), "turquoise blue" => array(6, 177, 196), "off the beaten path pink" => array(205, 117, 132), "sandy" => array(241, 218, 122), "electric pink" => array(255, 4, 144), "muted purple" => array(128, 91, 135), "mid green" => array(80, 167, 71), "greyish" => array(168, 164, 149), "neon yellow" => array(207, 255, 4), "banana" => array(255, 255, 126), "carnation pink" => array(255, 127, 167), "tomato" => array(239, 64, 38), "sea" => array(60, 153, 146), "muddy brown" => array(136, 104, 6), "turquoise green" => array(4, 244, 137), "buff" => array(254, 246, 158), "fawn" => array(207, 175, 123), "muted blue" => array(59, 113, 159), "pale rose" => array(253, 193, 197), "dark mint green" => array(32, 192, 115), "amethyst" => array(155, 95, 192), "chestnut" => array(116, 40, 2), "sick green" => array(157, 185, 44), "pea" => array(164, 191, 32), "rusty orange" => array(205, 89, 9), "stone" => array(173, 165, 135), "rose red" => array(190, 1, 60), "pale aqua" => array(184, 255, 235), "deep orange" => array(220, 77, 1), "earth" => array(162, 101, 62), "mossy green" => array(99, 139, 39), "grassy green" => array(65, 156, 3), "pale lime green" => array(177, 255, 101), "light grey blue" => array(157, 188, 212), "pale grey" => array(253, 253, 254), "asparagus" => array(119, 171, 86), "blueberry" => array(70, 65, 150), "purple red" => array(153, 1, 71), "pale lime" => array(190, 253, 115), "greenish teal" => array(50, 191, 132), "caramel" => array(175, 111, 9), "deep magenta" => array(160, 2, 92), "light peach" => array(255, 216, 177), "milk chocolate" => array(127, 78, 30), "ocher" => array(191, 155, 12), "off green" => array(107, 163, 83), "purply pink" => array(240, 117, 230), "lightblue" => array(123, 200, 246), "dusky blue" => array(71, 95, 148), "golden" => array(245, 191, 3), "light beige" => array(255, 254, 182), "butter yellow" => array(255, 253, 116), "dusky purple" => array(137, 91, 123), "french blue" => array(67, 107, 173), "ugly yellow" => array(208, 193, 1), "greeny yellow" => array(198, 248, 8), "orangish red" => array(244, 54, 5), "shamrock green" => array(2, 193, 77), "orangish brown" => array(178, 95, 3), "tree green" => array(42, 126, 25), "deep violet" => array(73, 6, 72), "gunmetal" => array(83, 98, 103), "cherry" => array(207, 2, 52), "sandy brown" => array(196, 166, 97), "warm grey" => array(151, 138, 132), "dark indigo" => array(31, 9, 84), "midnight" => array(3, 1, 45), "bluey green" => array(43, 177, 121), "grey pink" => array(195, 144, 155), "soft purple" => array(166, 111, 181), "blood" => array(119, 0, 1), "brown red" => array(146, 43, 5), "medium grey" => array(125, 127, 124), "berry" => array(153, 15, 75), "poo" => array(143, 115, 3), "purpley pink" => array(200, 60, 185), "light salmon" => array(254, 169, 147), "snot" => array(172, 187, 13), "easter purple" => array(192, 113, 254), "light yellow green" => array(204, 253, 127), "dark navy blue" => array(0, 2, 46), "drab" => array(130, 131, 68), "light rose" => array(255, 197, 203), "rouge" => array(171, 18, 57), "purplish red" => array(176, 5, 75), "slime green" => array(153, 204, 4), "baby poop" => array(147, 124, 0), "irish green" => array(1, 149, 41), "dark navy" => array(0, 4, 53), "greeny blue" => array(66, 179, 149), "light plum" => array(157, 87, 131), "pinkish grey" => array(200, 172, 169), "dirty orange" => array(200, 118, 6), "rust red" => array(170, 39, 4), "pale lilac" => array(228, 203, 255), "orangey red" => array(250, 66, 36), "primary blue" => array(8, 4, 249), "kermit green" => array(92, 178, 0), "brownish purple" => array(118, 66, 78), "murky green" => array(108, 122, 14), "wheat" => array(251, 221, 126), "very dark purple" => array(42, 1, 52), "bottle green" => array(4, 74, 5), "watermelon" => array(253, 70, 89), "deep sky blue" => array(13, 117, 248), "fire engine red" => array(254, 0, 2), "yellow ochre" => array(203, 157, 6), "pumpkin orange" => array(251, 125, 7), "pale olive" => array(185, 204, 129), "light lilac" => array(237, 200, 255), "lightish green" => array(97, 225, 96), "carolina blue" => array(138, 184, 254), "mulberry" => array(146, 10, 78), "shocking pink" => array(254, 2, 162), "auburn" => array(154, 48, 1), "bright lime green" => array(101, 254, 8), "celadon" => array(190, 253, 183), "pinkish brown" => array(177, 114, 97), "poo brown" => array(136, 95, 1), "bright sky blue" => array(2, 204, 254), "celery" => array(193, 253, 149), "dirt brown" => array(131, 101, 57), "strawberry" => array(251, 41, 67), "dark lime" => array(132, 183, 1), "copper" => array(182, 99, 37), "medium brown" => array(127, 81, 18), "muted green" => array(95, 160, 82), "robin's egg" => array(109, 237, 253), "bright aqua" => array(11, 249, 234), "bright lavender" => array(199, 96, 255), "ivory" => array(255, 255, 203), "very light purple" => array(246, 206, 252), "light navy" => array(21, 80, 132), "pink red" => array(245, 5, 79), "olive brown" => array(100, 84, 3), "poop brown" => array(122, 89, 1), "mustard green" => array(168, 181, 4), "ocean green" => array(61, 153, 115), "very dark blue" => array(0, 1, 51), "dusty green" => array(118, 169, 115), "light navy blue" => array(46, 90, 136), "minty green" => array(11, 247, 125), "adobe" => array(189, 108, 72), "barney" => array(172, 29, 184), "jade green" => array(43, 175, 106), "bright light blue" => array(38, 247, 253), "light lime" => array(174, 253, 108), "dark khaki" => array(155, 143, 85), "orange yellow" => array(255, 173, 1), "ocre" => array(198, 156, 4), "maize" => array(244, 208, 84), "faded pink" => array(222, 157, 172), "british racing green" => array(5, 72, 13), "sandstone" => array(201, 174, 116), "mud brown" => array(96, 70, 15), "light sea green" => array(152, 246, 176), "robin egg blue" => array(138, 241, 254), "aqua marine" => array(46, 232, 187), "dark sea green" => array(17, 135, 93), "soft pink" => array(253, 176, 192), "orangey brown" => array(177, 96, 2), "cherry red" => array(247, 2, 42), "burnt yellow" => array(213, 171, 9), "brownish grey" => array(134, 119, 95), "camel" => array(198, 159, 89), "purplish grey" => array(122, 104, 127), "marine" => array(4, 46, 96), "greyish pink" => array(200, 141, 148), "pale turquoise" => array(165, 251, 213), "pastel yellow" => array(255, 254, 113), "bluey purple" => array(98, 65, 199), "canary yellow" => array(255, 254, 64), "faded red" => array(211, 73, 78), "sepia" => array(152, 94, 43), "coffee" => array(166, 129, 76), "bright magenta" => array(255, 8, 232), "mocha" => array(157, 118, 81), "ecru" => array(254, 255, 202), "purpleish" => array(152, 86, 141), "cranberry" => array(158, 0, 58), "darkish green" => array(40, 124, 55), "brown orange" => array(185, 105, 2), "dusky rose" => array(186, 104, 115), "melon" => array(255, 120, 85), "sickly green" => array(148, 178, 28), "silver" => array(197, 201, 199), "purply blue" => array(102, 26, 238), "purpleish blue" => array(97, 64, 239), "hospital green" => array(155, 229, 170), "shit brown" => array(123, 88, 4), "mid blue" => array(39, 106, 179), "amber" => array(254, 179, 8), "easter green" => array(140, 253, 126), "soft blue" => array(100, 136, 234), "cerulean blue" => array(5, 110, 238), "golden brown" => array(178, 122, 1), "bright turquoise" => array(15, 254, 249), "red pink" => array(250, 42, 85), "red purple" => array(130, 7, 71), "greyish brown" => array(122, 106, 79), "vermillion" => array(244, 50, 12), "russet" => array(161, 57, 5), "steel grey" => array(111, 130, 138), "lighter purple" => array(165, 90, 244), "bright violet" => array(173, 10, 253), "prussian blue" => array(0, 69, 119), "slate green" => array(101, 141, 109), "dirty pink" => array(202, 123, 128), "dark blue green" => array(0, 82, 73), "pine" => array(43, 93, 52), "yellowy green" => array(191, 241, 40), "dark gold" => array(181, 148, 16), "bluish" => array(41, 118, 187), "darkish blue" => array(1, 65, 130), "dull red" => array(187, 63, 63), "pinky red" => array(252, 38, 71), "bronze" => array(168, 121, 0), "pale teal" => array(130, 203, 178), "military green" => array(102, 124, 62), "barbie pink" => array(254, 70, 165), "bubblegum pink" => array(254, 131, 204), "pea soup green" => array(148, 166, 23), "dark mustard" => array(168, 137, 5), "shit" => array(127, 95, 0), "medium purple" => array(158, 67, 162), "very dark green" => array(6, 46, 3), "dirt" => array(138, 110, 69), "dusky pink" => array(204, 122, 139), "red violet" => array(158, 1, 104), "lemon yellow" => array(253, 255, 56), "pistachio" => array(192, 250, 139), "dull yellow" => array(238, 220, 91), "dark lime green" => array(126, 189, 1), "denim blue" => array(59, 91, 146), "teal blue" => array(1, 136, 159), "lightish blue" => array(61, 122, 253), "purpley blue" => array(95, 52, 231), "light indigo" => array(109, 90, 207), "swamp green" => array(116, 133, 0), "brown green" => array(112, 108, 17), "dark maroon" => array(60, 0, 8), "hot purple" => array(203, 0, 245), "dark forest green" => array(0, 45, 4), "faded blue" => array(101, 140, 187), "drab green" => array(116, 149, 81), "light lime green" => array(185, 255, 102), "snot green" => array(157, 193, 0), "yellowish" => array(250, 238, 102), "light blue green" => array(126, 251, 179), "bordeaux" => array(123, 0, 44), "light mauve" => array(194, 146, 161), "ocean" => array(1, 123, 146), "marigold" => array(252, 192, 6), "muddy green" => array(101, 116, 50), "dull orange" => array(216, 134, 59), "steel" => array(115, 133, 149), "electric purple" => array(170, 35, 255), "fluorescent green" => array(8, 255, 8), "yellowish brown" => array(155, 122, 1), "blush" => array(242, 158, 142), "soft green" => array(111, 194, 118), "bright orange" => array(255, 91, 0), "lemon" => array(253, 255, 82), "purple grey" => array(134, 111, 133), "acid green" => array(143, 254, 9), "pale lavender" => array(238, 207, 254), "violet blue" => array(81, 10, 201), "light forest green" => array(79, 145, 83), "burnt red" => array(159, 35, 5), "khaki green" => array(114, 134, 57), "cerise" => array(222, 12, 98), "faded purple" => array(145, 110, 153), "apricot" => array(255, 177, 109), "dark olive green" => array(60, 77, 3), "grey brown" => array(127, 112, 83), "green grey" => array(119, 146, 111), "true blue" => array(1, 15, 204), "pale violet" => array(206, 174, 250), "periwinkle blue" => array(143, 153, 251), "light sky blue" => array(198, 252, 255), "blurple" => array(85, 57, 204), "green brown" => array(84, 78, 3), "bluegreen" => array(1, 122, 121), "bright teal" => array(1, 249, 198), "brownish yellow" => array(201, 176, 3), "pea soup" => array(146, 153, 1), "forest" => array(11, 85, 9), "barney purple" => array(160, 4, 152), "ultramarine" => array(32, 0, 177), "purplish" => array(148, 86, 140), "puke yellow" => array(194, 190, 14), "bluish grey" => array(116, 139, 151), "dark periwinkle" => array(102, 95, 209), "dark lilac" => array(156, 109, 165), "reddish" => array(196, 66, 64), "light maroon" => array(162, 72, 87), "dusty purple" => array(130, 95, 135), "terra cotta" => array(201, 100, 59), "avocado" => array(144, 177, 52), "marine blue" => array(1, 56, 106), "teal green" => array(37, 163, 111), "slate grey" => array(89, 101, 109), "lighter green" => array(117, 253, 99), "electric green" => array(33, 252, 13), "dusty blue" => array(90, 134, 173), "golden yellow" => array(254, 198, 21), "bright yellow" => array(255, 253, 1), "light lavender" => array(223, 197, 254), "umber" => array(178, 100, 0), "poop" => array(127, 94, 0), "dark peach" => array(222, 126, 93), "jungle green" => array(4, 130, 67), "eggshell" => array(255, 255, 212), "denim" => array(59, 99, 140), "yellow brown" => array(183, 148, 0), "dull purple" => array(132, 89, 126), "chocolate brown" => array(65, 25, 0), "wine red" => array(123, 3, 35), "neon blue" => array(4, 217, 255), "dirty green" => array(102, 126, 44), "light tan" => array(251, 238, 172), "ice blue" => array(215, 255, 254), "cadet blue" => array(78, 116, 150), "dark mauve" => array(135, 76, 98), "very light blue" => array(213, 255, 255), "grey purple" => array(130, 109, 140), "pastel pink" => array(255, 186, 205), "very light green" => array(209, 255, 189), "dark sky blue" => array(68, 142, 228), "evergreen" => array(5, 71, 42), "dull pink" => array(213, 134, 157), "aubergine" => array(61, 7, 52), "mahogany" => array(74, 1, 0), "reddish orange" => array(248, 72, 28), "deep green" => array(2, 89, 15), "vomit green" => array(137, 162, 3), "purple pink" => array(224, 63, 216), "dusty pink" => array(213, 138, 148), "faded green" => array(123, 178, 116), "camo green" => array(82, 101, 37), "pinky purple" => array(201, 76, 190), "pink purple" => array(219, 75, 218), "brownish red" => array(158, 54, 35), "dark rose" => array(181, 72, 93), "mud" => array(115, 92, 18), "brownish" => array(156, 109, 87), "emerald green" => array(2, 143, 30), "pale brown" => array(177, 145, 110), "dull blue" => array(73, 117, 156), "burnt umber" => array(160, 69, 14), "medium green" => array(57, 173, 72), "clay" => array(182, 106, 80), "light aqua" => array(140, 255, 219), "light olive green" => array(164, 190, 92), "brownish orange" => array(203, 119, 35), "dark aqua" => array(5, 105, 107), "purplish pink" => array(206, 93, 174), "dark salmon" => array(200, 90, 83), "greenish grey" => array(150, 174, 141), "jade" => array(31, 167, 116), "ugly green" => array(122, 151, 3), "dark beige" => array(172, 147, 98), "emerald" => array(1, 160, 73), "pale red" => array(217, 84, 77), "light magenta" => array(250, 95, 247), "sky" => array(130, 202, 252), "light cyan" => array(172, 255, 252), "yellow orange" => array(252, 176, 1), "reddish purple" => array(145, 9, 81), "reddish pink" => array(254, 44, 84), "orchid" => array(200, 117, 196), "dirty yellow" => array(205, 197, 10), "orange red" => array(253, 65, 30), "deep red" => array(154, 2, 0), "orange brown" => array(190, 100, 0), "cobalt blue" => array(3, 10, 167), "neon pink" => array(254, 1, 154), "rose pink" => array(247, 135, 154), "greyish purple" => array(136, 113, 145), "raspberry" => array(176, 1, 73), "aqua green" => array(18, 225, 147), "salmon pink" => array(254, 123, 124), "tangerine" => array(255, 148, 8), "brownish green" => array(106, 110, 9), "red brown" => array(139, 46, 22), "greenish brown" => array(105, 97, 18), "pumpkin" => array(225, 119, 1), "pine green" => array(10, 72, 30), "charcoal" => array(52, 56, 55), "baby pink" => array(255, 183, 206), "cornflower" => array(106, 121, 247), "blue violet" => array(93, 6, 233), "chocolate" => array(61, 28, 2), "greyish green" => array(130, 166, 125), "scarlet" => array(190, 1, 25), "green yellow" => array(201, 255, 39), "dark olive" => array(55, 62, 2), "sienna" => array(169, 86, 30), "pastel purple" => array(202, 160, 255), "terracotta" => array(202, 102, 65), "aqua blue" => array(2, 216, 233), "sage green" => array(136, 179, 120), "blood red" => array(152, 0, 2), "deep pink" => array(203, 1, 98), "grass" => array(92, 172, 45), "moss" => array(118, 153, 88), "pastel blue" => array(162, 191, 254), "bluish green" => array(16, 166, 116), "green blue" => array(6, 180, 139), "dark tan" => array(175, 136, 74), "greenish blue" => array(11, 139, 135), "pale orange" => array(255, 167, 86), "vomit" => array(162, 164, 21), "forrest green" => array(21, 68, 6), "dark lavender" => array(133, 103, 152), "dark violet" => array(52, 1, 63), "purple blue" => array(99, 45, 233), "dark cyan" => array(10, 136, 138), "olive drab" => array(111, 118, 50), "pinkish" => array(212, 106, 126), "cobalt" => array(30, 72, 143), "neon purple" => array(188, 19, 254), "light turquoise" => array(126, 244, 204), "apple green" => array(118, 205, 38), "dull green" => array(116, 166, 98), "wine" => array(128, 1, 63), "powder blue" => array(177, 209, 252), "off white" => array(255, 255, 228), "electric blue" => array(6, 82, 255), "dark turquoise" => array(4, 92, 90), "blue purple" => array(87, 41, 206), "azure" => array(6, 154, 243), "bright red" => array(255, 0, 13), "pinkish red" => array(241, 12, 69), "cornflower blue" => array(81, 112, 215), "light olive" => array(172, 191, 105), "grape" => array(108, 52, 97), "greyish blue" => array(94, 129, 157), "purplish blue" => array(96, 30, 249), "yellowish green" => array(176, 221, 22), "greenish yellow" => array(205, 253, 2), "medium blue" => array(44, 111, 187), "dusty rose" => array(192, 115, 122), "light violet" => array(214, 180, 252), "midnight blue" => array(2, 0, 53), "bluish purple" => array(112, 59, 231), "red orange" => array(253, 60, 6), "dark magenta" => array(150, 0, 86), "greenish" => array(64, 163, 104), "ocean blue" => array(3, 113, 156), "coral" => array(252, 90, 80), "cream" => array(255, 255, 194), "reddish brown" => array(127, 43, 10), "burnt sienna" => array(176, 78, 15), "brick" => array(160, 54, 35), "sage" => array(135, 174, 115), "grey green" => array(120, 155, 115), "white" => array(255, 255, 255), "robin's egg blue" => array(152, 239, 249), "moss green" => array(101, 139, 56), "steel blue" => array(90, 125, 154), "eggplant" => array(56, 8, 53), "light yellow" => array(255, 254, 122), "leaf green" => array(92, 169, 4), "light grey" => array(216, 220, 214), "puke" => array(165, 165, 2), "pinkish purple" => array(214, 72, 215), "sea blue" => array(4, 116, 149), "pale purple" => array(183, 144, 212), "slate blue" => array(91, 124, 153), "blue grey" => array(96, 124, 142), "hunter green" => array(11, 64, 8), "fuchsia" => array(237, 13, 217), "crimson" => array(140, 0, 15), "pale yellow" => array(255, 255, 132), "ochre" => array(191, 144, 5), "mustard yellow" => array(210, 189, 10), "light red" => array(255, 71, 76), "cerulean" => array(4, 133, 209), "pale pink" => array(255, 207, 220), "deep blue" => array(4, 2, 115), "rust" => array(168, 60, 9), "light teal" => array(144, 228, 193), "slate" => array(81, 101, 114), "goldenrod" => array(250, 194, 5), "dark yellow" => array(213, 182, 10), "dark grey" => array(54, 55, 55), "army green" => array(75, 93, 22), "grey blue" => array(107, 139, 164), "seafoam" => array(128, 249, 173), "puce" => array(165, 126, 82), "spring green" => array(169, 249, 113), "dark orange" => array(198, 81, 2), "sand" => array(226, 202, 118), "pastel green" => array(176, 255, 157), "mint" => array(159, 254, 176), "light orange" => array(253, 170, 72), "bright pink" => array(254, 1, 177), "chartreuse" => array(193, 248, 10), "deep purple" => array(54, 1, 63), "dark brown" => array(52, 28, 2), "taupe" => array(185, 162, 129), "pea green" => array(142, 171, 18), "puke green" => array(154, 174, 7), "kelly green" => array(2, 171, 46), "seafoam green" => array(122, 249, 171), "blue green" => array(19, 126, 109), "khaki" => array(170, 166, 98), "burgundy" => array(97, 0, 35), "dark teal" => array(1, 77, 78), "brick red" => array(143, 20, 2), "royal purple" => array(75, 0, 110), "plum" => array(88, 15, 65), "mint green" => array(143, 255, 159), "gold" => array(219, 180, 12), "baby blue" => array(162, 207, 254), "yellow green" => array(192, 251, 45), "bright purple" => array(190, 3, 253), "dark red" => array(132, 0, 0), "pale blue" => array(208, 254, 254), "grass green" => array(63, 155, 11), "navy" => array(1, 21, 62), "aquamarine" => array(4, 216, 178), "burnt orange" => array(192, 78, 1), "neon green" => array(12, 255, 12), "bright blue" => array(1, 101, 252), "rose" => array(207, 98, 117), "light pink" => array(255, 209, 223), "mustard" => array(206, 179, 1), "indigo" => array(56, 2, 130), "lime" => array(170, 255, 50), "sea green" => array(83, 252, 161), "periwinkle" => array(142, 130, 254), "dark pink" => array(203, 65, 107), "olive green" => array(103, 122, 4), "peach" => array(255, 176, 124), "pale green" => array(199, 253, 181), "light brown" => array(173, 129, 80), "hot pink" => array(255, 2, 141), "black" => array(0, 0, 0), "lilac" => array(206, 162, 253), "navy blue" => array(0, 17, 70), "royal blue" => array(5, 4, 170), "beige" => array(230, 218, 166), "salmon" => array(255, 121, 108), "olive" => array(110, 117, 14), "maroon" => array(101, 0, 33), "bright green" => array(1, 255, 7), "dark purple" => array(53, 6, 62), "mauve" => array(174, 113, 129), "forest green" => array(6, 71, 12), "aqua" => array(19, 234, 201), "cyan" => array(0, 255, 255), "tan" => array(209, 178, 111), "dark blue" => array(0, 3, 91), "lavender" => array(199, 159, 239), "turquoise" => array(6, 194, 172), "dark green" => array(3, 53, 0), "violet" => array(154, 14, 234), "light purple" => array(191, 119, 246), "lime green" => array(137, 254, 5), "grey" => array(146, 149, 145), "sky blue" => array(117, 187, 253), "yellow" => array(255, 255, 20), "magenta" => array(194, 0, 120), "light green" => array(150, 249, 123), "orange" => array(249, 115, 6), "teal" => array(2, 147, 134), "light blue" => array(149, 208, 252), "red" => array(229, 0, 0), "brown" => array(101, 55, 0), "pink" => array(255, 129, 192), "blue" => array(3, 67, 223), "green" => array(21, 176, 26), "purple" => array(126, 30, 156));
    $value = "#" . $color;
    $distances = array();
    $val = html2rgb($value);
    foreach ($colors as $name => $c) {
        $distances[$name] = distancel2($c, $val);
    }
    $mincolor = "";
    $minval = pow(2, 30);
    /*big value*/
    foreach ($distances as $k => $v) {
        if ($v < $minval) {
            $minval = $v;
            $mincolor = $k;
        }
    }
    return str_replace(" ", "-", $mincolor);
}
示例#4
0
 public function apply($resource)
 {
     // Verify support
     if (!function_exists('imagefilter')) {
         throw new Exception("It seems your PHP version is not compiled with the bundled version of the GD library");
     }
     // Extract arguments
     @(list(, $color, $opacity) = func_get_args());
     $rgb = html2rgb($color);
     // Normalize
     if ($opacity === null) {
         $opacity = 100;
     } elseif ($opacity < 0) {
         $opacity = 0;
     } elseif ($opacity > 100) {
         $opacity = 100;
     }
     $a = (100 - $opacity) * 1.27;
     // Apply effect
     if (!imagefilter($resource, IMG_FILTER_COLORIZE, $rgb[0], $rgb[1], $rgb[2], $a)) {
         throw new Exception("COLORIZE filter failed");
     }
     return $resource;
 }
示例#5
0
    }
    $r = hexdec($r);
    $g = hexdec($g);
    $b = hexdec($b);
    return array($r, $g, $b);
}
function rgb2html($r, $g = -1, $b = -1)
{
    if (is_array($r) && sizeof($r) == 3) {
        list($r, $g, $b) = $r;
    }
    $r = intval($r);
    $g = intval($g);
    $b = intval($b);
    $r = dechex($r < 0 ? 0 : ($r > 255 ? 255 : $r));
    $g = dechex($g < 0 ? 0 : ($g > 255 ? 255 : $g));
    $b = dechex($b < 0 ? 0 : ($b > 255 ? 255 : $b));
    $color = (strlen($r) < 2 ? '0' : '') . $r;
    $color .= (strlen($g) < 2 ? '0' : '') . $g;
    $color .= (strlen($b) < 2 ? '0' : '') . $b;
    return '<div style="background:#' . $color . ';"><a href="#">#' . $color . '</a></div>';
}
$a = html2rgb('ffffe0');
$b = html2rgb('ff9480');
$size = 9;
echo '<link rel="stylesheet" href="css/style.css" />';
echo '<div class="contenttable">';
for ($i = 0; $i <= 100; $i += 100 / ($size - 1)) {
    echo rgb2html(array($a[0] + ($b[0] - $a[0]) * $i / 100, $a[1] + ($b[1] - $a[1]) * $i / 100, $a[2] + ($b[2] - $a[2]) * $i / 100)) . "\n";
}
echo '</div>';
示例#6
0
    if (preg_match("/[^A-Za-z0-9_-]/", $hex)) {
        header("location: error.php?eType=invalidQuery");
        exit;
    }
    //unset($_SESSION['searchForm']['resultsArray']); // Clear any previous results array
    $_SESSION['searchForm']['hex'] = $hex;
    if ($_REQUEST['red']) {
        if (preg_match("/[^A-Za-z0-9_-]/", $red) or preg_match("/[^A-Za-z0-9_-]/", $green) or preg_match("/[^A-Za-z0-9_-]/", $blue)) {
            header("location: error.php?eType=invalidQuery");
            exit;
        }
        $_SESSION['searchForm']['red'] = $red;
        $_SESSION['searchForm']['green'] = $green;
        $_SESSION['searchForm']['blue'] = $blue;
    } else {
        $rgbColor = html2rgb($hex);
        // Convert hex to rgb
        $_SESSION['searchForm']['red'] = $rgbColor['red'];
        $_SESSION['searchForm']['green'] = $rgbColor['green'];
        $_SESSION['searchForm']['blue'] = $rgbColor['blue'];
    }
    $_SESSION['searchForm']['inSearch'] = true;
}
// Orientation search passed
if ($_REQUEST['orientations']) {
    //unset($_SESSION['searchForm']['resultsArray']); // Clear any previous results array
    unset($_SESSION['searchForm']['orientations']);
    // Clear ori first
    foreach ($_REQUEST['orientations'] as $key => $value) {
        $_SESSION['searchForm']['orientations'][$key] = $value;
    }
示例#7
0
function generateSoundWave($input, $output, $width, $height, $foreground, $background)
{
    /**
     * PROCESS THE FILE
     */
    // temporary file name
    $tmpname = substr(md5(time()), 0, 10);
    $draw_flat = false;
    // copy from temp upload directory to current
    copy($input, "{$tmpname}_o.mp3");
    // array of wavs that need to be processed
    $wavs_to_process = array();
    /**
     * convert mp3 to wav using lame decoder
     * First, resample the original mp3 using as mono (-m m), 16 bit (-b 16), and 8 KHz (--resample 8)
     * Secondly, convert that resampled mp3 into a wav
     * We don't necessarily need high quality audio to produce a waveform, doing this process reduces the WAV
     * to it's simplest form and makes processing significantly faster
     */
    exec("lame {$tmpname}_o.mp3 -m m -S -f -b 16 --resample 8 {$tmpname}.mp3 && lame -S --decode {$tmpname}.mp3 {$tmpname}.wav");
    $wavs_to_process[] = "{$tmpname}.wav";
    // delete temporary files
    unlink("{$tmpname}_o.mp3");
    unlink("{$tmpname}.mp3");
    $img = false;
    // generate foreground color
    list($r, $g, $b) = html2rgb($foreground);
    // process each wav individually
    for ($wav = 1; $wav <= sizeof($wavs_to_process); $wav++) {
        $filename = $wavs_to_process[$wav - 1];
        /**
         * Below as posted by "zvoneM" on
         * http://forums.devshed.com/php-development-5/reading-16-bit-wav-file-318740.html
         * as findValues() defined above
         * Translated from Croation to English - July 11, 2011
         */
        $handle = fopen($filename, "r");
        // wav file header retrieval
        $heading[] = fread($handle, 4);
        $heading[] = bin2hex(fread($handle, 4));
        $heading[] = fread($handle, 4);
        $heading[] = fread($handle, 4);
        $heading[] = bin2hex(fread($handle, 4));
        $heading[] = bin2hex(fread($handle, 2));
        $heading[] = bin2hex(fread($handle, 2));
        $heading[] = bin2hex(fread($handle, 4));
        $heading[] = bin2hex(fread($handle, 4));
        $heading[] = bin2hex(fread($handle, 2));
        $heading[] = bin2hex(fread($handle, 2));
        $heading[] = fread($handle, 4);
        $heading[] = bin2hex(fread($handle, 4));
        // wav bitrate
        $peek = hexdec(substr($heading[10], 0, 2));
        $byte = $peek / 8;
        // checking whether a mono or stereo wav
        $channel = hexdec(substr($heading[6], 0, 2));
        $ratio = $channel == 2 ? 40 : 80;
        // start putting together the initial canvas
        // $data_size = (size_of_file - header_bytes_read) / skipped_bytes + 1
        $data_size = floor((filesize($filename) - 44) / ($ratio + $byte) + 1);
        $data_point = 0;
        // now that we have the data_size for a single channel (they both will be the same)
        // we can initialize our image canvas
        if (!$img) {
            // create original image width based on amount of detail
            // each waveform to be processed with be $height high, but will be condensed
            // and resized later (if specified)
            $img = imagecreatetruecolor($data_size / DETAIL, $height * sizeof($wavs_to_process));
            // fill background of image
            if ($background == "") {
                // transparent background specified
                imagesavealpha($img, true);
                $transparentColor = imagecolorallocatealpha($img, 0, 0, 0, 127);
                imagefill($img, 0, 0, $transparentColor);
            } else {
                list($br, $bg, $bb) = html2rgb($background);
                imagefilledrectangle($img, 0, 0, (int) ($data_size / DETAIL), $height * sizeof($wavs_to_process), imagecolorallocate($img, $br, $bg, $bb));
            }
        }
        while (!feof($handle) && $data_point < $data_size) {
            if ($data_point++ % DETAIL == 0) {
                $bytes = array();
                // get number of bytes depending on bitrate
                for ($i = 0; $i < $byte; $i++) {
                    $bytes[$i] = fgetc($handle);
                }
                switch ($byte) {
                    // get value for 8-bit wav
                    case 1:
                        $data = findValues($bytes[0], $bytes[1]);
                        break;
                        // get value for 16-bit wav
                    // get value for 16-bit wav
                    case 2:
                        if (ord($bytes[1]) & 128) {
                            $temp = 0;
                        } else {
                            $temp = 128;
                        }
                        $temp = chr((ord($bytes[1]) & 127) + $temp);
                        $data = floor(findValues($bytes[0], $temp) / 256);
                        break;
                }
                // skip bytes for memory optimization
                fseek($handle, $ratio, SEEK_CUR);
                // draw this data point
                // relative value based on height of image being generated
                // data values can range between 0 and 255
                $v = (int) ($data / 255 * $height);
                // don't print flat values on the canvas if not necessary
                if (!($v / $height == 0.5 && !$draw_flat)) {
                    // draw the line on the image using the $v value and centering it vertically on the canvas
                    imageline($img, (int) ($data_point / DETAIL), $height * $wav - $v, (int) ($data_point / DETAIL), $height * $wav - ($height - $v), imagecolorallocate($img, $r, $g, $b));
                }
            } else {
                // skip this one due to lack of detail
                fseek($handle, $ratio + $byte, SEEK_CUR);
            }
        }
        fclose($handle);
        // delete the processed wav file
        unlink($filename);
    }
    // want it resized?
    $rimg = imagecreatetruecolor($width, $height);
    // save alpha from original image
    imagesavealpha($rimg, true);
    imagealphablending($rimg, false);
    // copy to resized
    imagecopyresampled($rimg, $img, 0, 0, 0, 0, $width, $height, imagesx($img), imagesy($img));
    imagepng($rimg, $output, 5);
    imagedestroy($rimg);
    imagedestroy($img);
}
示例#8
0
function pch_slicebar_graph($graph_type, $data, $period, $width, $height, $colors, $font, $round_corner, $font_size, $antialiasing = true)
{
    /* CAT:Slicebar charts */
    set_time_limit(0);
    // Dataset definition
    $myPicture = new pImage($width, $height);
    /* Turn of Antialiasing */
    $myPicture->Antialias = $antialiasing;
    $myPicture->setFontProperties(array("FontName" => $font, "FontSize" => $font_size, "R" => 80, "G" => 80, "B" => 80));
    // Round corners defined in global setup
    if ($round_corner != 0) {
        $radius = $height > 18 ? 8 : 0;
    } else {
        $radius = 0;
    }
    $thinest_slice = $width / $period;
    /* Color stuff */
    $colorsrgb = array();
    foreach ($colors as $key => $col) {
        $rgb = html2rgb($col);
        $colorsrgb[$key]['R'] = $rgb[0];
        $colorsrgb[$key]['G'] = $rgb[1];
        $colorsrgb[$key]['B'] = $rgb[2];
    }
    $i = 0;
    foreach ($data as $d) {
        $color = $d['data'];
        $color = $colorsrgb[$color];
        $ratio = $thinest_slice * $d['utimestamp'];
        $myPicture->drawRoundedFilledRectangle($i, 0, $ratio + $i, $height, $radius, array('R' => $color['R'], 'G' => $color['G'], 'B' => $color['B']));
        $i += $ratio;
    }
    if ($round_corner) {
        /* Under this value, the rounded rectangle is painted great */
        if ($thinest_slice <= 16) {
            /* Clean a bit of pixels */
            for ($i = 0; $i < 7; $i++) {
                $myPicture->drawLine(0, $i, 6 - $i, $i, array('R' => 255, 'G' => 255, 'B' => 255));
            }
            $end = $height - 1;
            for ($i = 0; $i < 7; $i++) {
                $myPicture->drawLine(0, $end - $i, 5 - $i, $end - $i, array('R' => 255, 'G' => 255, 'B' => 255));
            }
        }
    }
    $myPicture->drawRoundedRectangle(0, 0, $width, $height - 1, $radius, array('R' => 157, 'G' => 157, 'B' => 157));
    $myPicture->Stroke();
}
示例#9
0
/**
* Render the actual video frames
* 
* @param mixed $tests
* @param mixed $frameCount
* @param mixed $im
*/
function RenderFrames(&$tests, $frameCount, $im)
{
    global $width, $height, $backgroundColor, $videoPath, $image_bytes, $textColor, $encodeFormat, $encoderSpeed, $fps, $labelHeight, $forceBackgroundColor, $forceTextColor, $combineTimeLabel, $evenTextBackground, $oddTextBackground, $bgEvenText, $bgOddText;
    // allocate the background and foreground colors
    $bgcolor = isset($tests[0]['bg']) ? html2rgb($tests[0]['bg']) : html2rgb('000000');
    $color = isset($tests[0]['text']) ? html2rgb($tests[0]['text']) : html2rgb('ffffff');
    if (isset($forceBackgroundColor)) {
        $bgcolor = html2rgb($forceBackgroundColor);
    }
    if (isset($forceTextColor)) {
        $color = html2rgb($forceTextColor);
    }
    $bgEvenTextColor = isset($evenTextBackground) ? html2rgb($evenTextBackground) : $bgcolor;
    $bgOddTextColor = isset($oddTextBackground) ? html2rgb($oddTextBackground) : $bgcolor;
    // prepare the image
    $backgroundColor = imagecolorallocate($im, $bgcolor[0], $bgcolor[1], $bgcolor[2]);
    $textColor = imagecolorallocate($im, $color[0], $color[1], $color[2]);
    $bgEvenText = imagecolorallocate($im, $bgEvenTextColor[0], $bgEvenTextColor[1], $bgEvenTextColor[2]);
    $bgOddText = imagecolorallocate($im, $bgOddTextColor[0], $bgOddTextColor[1], $bgOddTextColor[2]);
    imagefilledrectangle($im, 0, 0, $width - 1, $height - 1, $backgroundColor);
    // figure out what a good interval for keyframes would be based on the video length
    $keyInt = min(max(6, $frameCount / 30), 240);
    // set up ffmpeg
    $descriptors = array(0 => array("pipe", "r"));
    $videoFile = realpath($videoPath) . '/render.mp4';
    if (is_file($videoFile)) {
        unlink($videoFile);
    }
    $codec = $encodeFormat == 'jpg' ? 'mjpeg' : $encodeFormat;
    $command = "ffmpeg -f image2pipe -vcodec {$codec} -r {$fps} -i - " . "-vcodec libx264 -r {$fps} -crf 24 -g {$keyInt} " . "-preset {$encoderSpeed} -y \"{$videoFile}\"";
    $ffmpeg = proc_open($command, $descriptors, $pipes);
    if (is_resource($ffmpeg)) {
        if ($labelHeight > 0 || $combineTimeLabel) {
            DrawLabels($tests, $im);
        }
        for ($frame = 0; $frame < $frameCount; $frame++) {
            RenderFrame($tests, $frame, $im);
            if (isset($image_bytes)) {
                fwrite($pipes[0], $image_bytes);
            }
        }
        fclose($pipes[0]);
        proc_close($ffmpeg);
    }
}
function makeHistogram($filepath, $filename, $pid)
{
    // set_time_limit(500);
    //HISTOGRAM VARIABLES
    global $CONFIG;
    $coppermineid = $pid;
    $source_file = $filepath . $filename;
    switch ($CONFIG['plugin_flf_histotag_imagesource']) {
        case '2':
            if (file_exists($filepath . $CONFIG['normal_pfx'] . $filename)) {
                // Intermediate file exists
                // use this one for faster calculations
                $source_file = $filepath . $CONFIG['normal_pfx'] . $filename;
            }
            break;
        case '3':
            if (file_exists($filepath . $CONFIG['thumb_pfx'] . $filename)) {
                // Thumbnail file exists
                // use this one for fastest calculations
                $source_file = $filepath . $CONFIG['thumb_pfx'] . $filename;
            }
            break;
        default:
            // Do nothing --> regular filename already used
            // Same as option '1'
            break;
    }
    $maxheight = 100;
    $barwidth = 1;
    $iscolor = false;
    $im = ImageCreateFromJpeg($source_file);
    $color = $CONFIG['plugin_flf_histotag_histocolor'];
    $imgw = imagesx($im);
    $imgh = imagesy($im);
    $n = $imgw * $imgh;
    $histo = array();
    $histoR = array();
    $histoG = array();
    $histoB = array();
    // ZERO HISTOGRAM VALUES
    for ($i = 0; $i < 256; $i++) {
        $histo[$i] = 0;
        $histoR[$i] = 0;
        $histoG[$i] = 0;
        $histoB[$i] = 0;
    }
    // CALCULATE PIXELS
    for ($i = 0; $i < $imgw; $i++) {
        for ($j = 0; $j < $imgh; $j++) {
            $rgb = ImageColorAt($im, $i, $j);
            $r = $rgb >> 16 & 0xff;
            $g = $rgb >> 8 & 0xff;
            $b = $rgb & 0xff;
            $V = round(($r + $g + $b) / 3);
            $histo[$V] += 1;
            $V = round($r * 1);
            $histoR[$V] += 1;
            $V = round($g * 1);
            $histoG[$V] += 1;
            $V = round($b * 1);
            $histoB[$V] += 1;
        }
    }
    imagedestroy($im);
    // COLOR OR GRAYSCALE
    for ($a = 0; $a < count($histoR); $a++) {
        if ($histoR[$a] != $histoG[$a] || $histoG[$a] != $histoB[$a]) {
            $iscolor = true;
            break;
        }
    }
    //CREATE HISTOGRAM IMAGE
    // TODO: internationalize!
    if ($CONFIG['plugin_flf_histotag_histotype'] == '1' or $iscolor == false) {
        $imR = imagecreatetruecolor(256, 100) or die("Cannot Initialize new GD image stream");
    } else {
        $imR = imagecreatetruecolor(256, 300) or die("Cannot Initialize new GD image stream");
    }
    // CONVERT BACKGROUND COLOR TO RGB
    $rgbcolor = html2rgb($color);
    //RGB
    if ($iscolor) {
        // MAKE BACKGROUND
        $back = imagecolorallocate($imR, $rgbcolor[0], $rgbcolor[1], $rgbcolor[2]);
        //$back = imagecolorallocate($imR, 37, 37, 37);
        // compute bounds of vertical axis
        // sort the histograms to find tallest bins
        $sHistoR = $histoR;
        $sHistoG = $histoG;
        $sHistoB = $histoB;
        sort($sHistoR);
        sort($sHistoG);
        sort($sHistoB);
        // we allow clipping of at most the 5 tallest histogram bins, but clipping
        // also needs to be useful. i.e. if clipping does not change the vertical
        // range much, then don't do it. The following heuristic code enforces this.
        $lerpR = min(max(($sHistoR[255] / $sHistoR[250] - 1.15) / 2.0, 0.0), 1.0);
        $lerpG = min(max(($sHistoG[255] / $sHistoG[250] - 1.15) / 2.0, 0.0), 1.0);
        $lerpB = min(max(($sHistoB[255] / $sHistoB[250] - 1.15) / 2.0, 0.0), 1.0);
        $histoClipR = (1.0 - $lerpR) * $sHistoR[255] + $lerpR * $sHistoR[250];
        $histoClipG = (1.0 - $lerpG) * $sHistoG[255] + $lerpG * $sHistoG[250];
        $histoClipB = (1.0 - $lerpB) * $sHistoB[255] + $lerpB * $sHistoB[250];
        $histoClip = max($histoClipR, $histoClipG, $histoClipB);
        if ($CONFIG['plugin_flf_histotag_histotype'] == '1') {
            // COMBINED COLOR HISTOGRAM
            imagefilledrectangle($imR, 0, 0, 256, 100, $back);
            // CREATE GRAPH
            for ($a = 0; $a < 256; $a++) {
                $heightsRGB = array(min($histoR[$a] / $histoClip, 1.0) * $maxheight, min($histoG[$a] / $histoClip, 1.0) * $maxheight, min($histoB[$a] / $histoClip, 1.0) * $maxheight);
                $lineOrder = array(0, 1, 2);
                array_multisort($heightsRGB, $lineOrder);
                // Draw 3 vertical lines.
                // First a white line, for the extent that all the histograms overlap,
                // Then as we cross each histogram, remove that appropriate color
                // component.
                $lineRGB = array(255, 255, 255);
                $lineColor = ImageColorAllocateAlpha($imR, $lineRGB[0], $lineRGB[1], $lineRGB[2], 0);
                $start = $maxheight - $heightsRGB[0];
                $end = $maxheight;
                imageline($imR, $a + 1, $start, $a + 1, $end, $lineColor);
                $lineRGB[$lineOrder[0]] = 0;
                $lineColor = ImageColorAllocateAlpha($imR, $lineRGB[0], $lineRGB[1], $lineRGB[2], 0);
                $start = $maxheight - $heightsRGB[1];
                $end = $maxheight - $heightsRGB[0];
                imageline($imR, $a + 1, $start, $a + 1, $end, $lineColor);
                $lineRGB[$lineOrder[1]] = 0;
                $lineColor = ImageColorAllocateAlpha($imR, $lineRGB[0], $lineRGB[1], $lineRGB[2], 0);
                $start = $maxheight - $heightsRGB[2];
                $end = $maxheight - $heightsRGB[1];
                imageline($imR, $a + 1, $start, $a + 1, $end, $lineColor);
            }
        } else {
            // SEPARATE R G B HISTOGRAMS
            imagefilledrectangle($imR, 0, 0, 256, 300, $back);
            // CREATE GRAPH
            for ($a = 0; $a < 256; $a++) {
                $lineColor = ImageColorAllocateAlpha($imR, 255, 0, 0, 0);
                $start = $maxheight - min($histoR[$a] / $histoClipR, 1.0) * $maxheight;
                $end = $maxheight;
                imageline($imR, $a + 1, $start, $a + 1, $end, $lineColor);
                $lineColor = ImageColorAllocateAlpha($imR, 0, 255, 0, 0);
                $start = $maxheight - min($histoG[$a] / $histoClipG, 1.0) * $maxheight;
                $end = $maxheight;
                imageline($imR, $a + 1, $start + 100, $a + 1, $end + 100, $lineColor);
                $lineColor = ImageColorAllocateAlpha($imR, 0, 0, 255, 0);
                $start = $maxheight - min($histoB[$a] / $histoClipB, 1.0) * $maxheight;
                $end = $maxheight;
                imageline($imR, $a + 1, $start + 200, $a + 1, $end + 200, $lineColor);
            }
        }
    } else {
        // GRAYSCALE
        // COMPUTE MAX VALUES
        $max = max($histo);
        // compute bounds of vertical axis
        // sort the histogram to find tallest bins
        $sortedHisto = $histo;
        sort($sortedHisto);
        // we allow clipping of at most the 5 tallest histogram bins, but clipping
        // also needs to be useful. i.e. if clipping does not change the vertical
        // range much, then don't do it. The following heuristic code enforces this.
        $lerpFactor = min(max(($sortedHisto[255] / $sortedHisto[250] - 1.15) / 2.0, 0.0), 1.0);
        $histoClip = (1.0 - $lerpFactor) * $sortedHisto[255] + $lerpFactor * $sortedHisto[250];
        // CREATE HISTOGRAM BACKGROUND
        $back = imagecolorallocate($imR, $rgbcolor[0], $rgbcolor[1], $rgbcolor[2]);
        imagefilledrectangle($imR, 0, 0, 256, 100, $back);
        // MAKE HISTOGRAM COLOR NOT MATCH BACKGROUND LIGHTNESS
        if (($rgbcolor[0] + $rgbcolor[0] + $rgbcolor[0]) / 3 < 127) {
            $graphcolor = 255;
        } else {
            $graphcolor = 0;
        }
        $text_color = ImageColorAllocateAlpha($imR, $graphcolor, $graphcolor, $graphcolor, 0);
        // CREATE HISTOGRAM
        for ($a = 0; $a < 256; $a++) {
            $h = min($histo[$a] / $histoClip, 1.0) * $maxheight;
            $start = $maxheight - $h;
            imageline($imR, $a + 1, $start, $a + 1, $maxheight, $text_color);
        }
        // ENG GRAY HISTOGRAM
    }
    // GET FILENAME OF FULL SIZE PHOTO
    $file = $coppermineid . '_' . $filename;
    // SAVE HISTOGRAM AND DESTROY RESOURCE
    touch($filepath . 'hist_' . $file);
    if ($CONFIG['plugin_flf_histotag_histowidth'] != 256) {
        $newW = $CONFIG['plugin_flf_histotag_histowidth'];
        $scale = $newW / 256;
        $width = imagesx($imR);
        $height = imagesy($imR);
        $new_width = floor($scale * $width);
        $new_height = floor($scale * $height);
        $tmp_img = imagecreatetruecolor($new_width, $new_height);
        // gd 2.0.1 or later: imagecopyresampled
        // gd less than 2.0: imagecopyresized
        if (function_exists(imagecopyresampled)) {
            imagecopyresampled($tmp_img, $imR, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
        } else {
            imagecopyresized($tmp_img, $imR, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
        }
        imagedestroy($imR);
        $imR = $tmp_img;
    }
    imagejpeg($imR, $filepath . 'hist_' . $file, $CONFIG['plugin_flf_histotag_histoquality']);
    $histogram = $filepath . 'hist_' . $file;
    chmod($histogram, 0644);
    imagedestroy($imR);
    $perms = fileperms("histograms");
    $retvar = true;
    return $retvar;
}
示例#11
0
function WA_DFP_ResizeImage($imageFilePath, $options)
{
    $imageInfo = getimagesize($imageFilePath);
    $mime = $imageInfo['mime'];
    $width = $imageInfo[0];
    $height = $imageInfo[1];
    $newWidth = $width;
    $newHeight = $height;
    $maxWidth = $options['ResizeWidth'];
    $maxHeight = $options['ResizeHeight'];
    $aspect_ratio = $width / $height;
    $fillColor = $options['ResizeFillColor'];
    $uniqueFileNamePart = uniqid(rand(), true);
    switch ($imageInfo[2]) {
        case IMAGETYPE_PNG:
            $src = imagecreatefrompng($imageFilePath);
            break;
        case IMAGETYPE_JPEG:
            $src = imagecreatefromjpeg($imageFilePath);
            break;
        case IMAGETYPE_GIF:
            $src = imagecreatefromgif($imageFilePath);
            break;
        default:
            $src = imagecreatetruecolor($width, $height);
            break;
    }
    $tmpIsSrc = false;
    switch ($options['ResizeType']) {
        case WADFP_FIT_TO_BOX:
            // Fit to box: image resized down to fit within a box with dimensions of $maxSize x $maxHeight
            if ($width > $maxWidth || $height > $maxHeight) {
                // need to resize down
                if ($maxWidth / $maxHeight > $aspect_ratio) {
                    $newWidth = round($maxHeight * $aspect_ratio);
                    $newHeight = $maxHeight;
                } else {
                    $newWidth = $maxWidth;
                    $newHeight = round($maxWidth / $aspect_ratio);
                }
                $src = resetTransparency($src, $options);
                $tmp = imagecreatetruecolor($newWidth, $newHeight);
                $tmp = WA_DFP_RetainTransparent($src, $tmp, $imageInfo);
                $tmp = resetTransparency($tmp, $options);
                imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
            } else {
                $tmp = imagecreatetruecolor($width, $height);
                $src = resetTransparency($src, $options);
                $tmp = WA_DFP_RetainTransparent($src, $tmp, $imageInfo);
                $tmp = resetTransparency($tmp, $options);
                imagecopyresampled($tmp, $src, 0, 0, 0, 0, $width, $height, $width, $height);
            }
            break;
        case WADFP_FIT_TO_WIDTH:
            // Fit to Width: image resize to $maxWidth and height modified to keep aspect ratio
            if ($width > $maxWidth) {
                // need to resize down
                $newWidth = $maxWidth;
                $newHeight = round($newWidth / $aspect_ratio);
                $tmp = imagecreatetruecolor($maxWidth, $newHeight);
                $src = resetTransparency($src, $options);
                $tmp = WA_DFP_RetainTransparent($src, $tmp, $imageInfo);
                $tmp = resetTransparency($tmp, $options);
                imagecopyresampled($tmp, $src, 0, 0, 0, 0, $maxWidth, $newHeight, $width, $height);
            } else {
                $tmp = imagecreatetruecolor($width, $height);
                $src = resetTransparency($src, $options);
                $tmp = WA_DFP_RetainTransparent($src, $tmp, $imageInfo);
                $tmp = resetTransparency($tmp, $options);
                imagecopyresampled($tmp, $src, 0, 0, 0, 0, $width, $height, $width, $height);
            }
            break;
        case WADFP_FIT_TO_HEIGHT:
            // Fit height: image resize down to $maxHeight and width modified to keep the aspect ratio
            if ($height > $maxHeight) {
                // need to resize down
                $newHeight = $maxHeight;
                $newWidth = round($newHeight * $aspect_ratio);
                $tmp = imagecreatetruecolor($newWidth, $maxHeight);
                $src = resetTransparency($src, $options);
                $tmp = WA_DFP_RetainTransparent($src, $tmp, $imageInfo);
                $tmp = resetTransparency($tmp, $options);
                imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $maxHeight, $width, $height);
            } else {
                $tmp = imagecreatetruecolor($width, $height);
                $src = resetTransparency($src, $options);
                $tmp = WA_DFP_RetainTransparent($src, $tmp, $imageInfo);
                $tmp = resetTransparency($tmp, $options);
                imagecopyresampled($tmp, $src, 0, 0, 0, 0, $width, $height, $width, $height);
            }
            break;
        case WADFP_FIXED_SIZE:
            // Fixed width and height: image resize to exact width and height and filled with fill color
            $newWidth = $width;
            $newHeight = $height;
            if ($maxWidth / $maxHeight > $aspect_ratio) {
                $newWidth = round($maxHeight * $aspect_ratio);
                $newHeight = $maxHeight;
            } else {
                $newWidth = $maxWidth;
                $newHeight = round($maxWidth / $aspect_ratio);
            }
            $tmp = imagecreatetruecolor($maxWidth, $maxHeight);
            if ($fillColor == '') {
                $fillColor = '#FFFFFF';
            }
            $fillColors = html2rgb($fillColor);
            $allocatedColor = imagecolorallocate($tmp, $fillColors[0], $fillColors[1], $fillColors[2]);
            imagefilledrectangle($tmp, 0, 0, $maxWidth, $maxHeight, $allocatedColor);
            $src = resetTransparency($src, $options);
            $tmp = WA_DFP_RetainTransparent($src, $tmp, $imageInfo);
            $tmp = resetTransparency($tmp, $options);
            imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
            $newWidth = $maxWidth;
            $newHeight = $maxHeight;
            break;
        default:
            $tmp = $src;
            $tmpIsSrc = true;
            break;
    }
    $path_parts = pathinfo($imageFilePath);
    $extension = isset($path_parts["extension"]) ? $path_parts["extension"] : '';
    $startExtension = strtolower($extension);
    $endExtension = $startExtension;
    // Adding new extension to end in case there isn't a file extension isn't present in file path
    $fileExtensionRegExp = '/' . $path_parts["basename"] . '$/';
    if ($options['imageFormat'] && $options['imageFormat'] !== '') {
        // convert to a specific format
        $imageOptions = explode(':', $options['imageFormat']);
        switch ($imageOptions[0]) {
            case WADFP_PNG:
                if ($startExtension != 'png') {
                    $newFilePath = preg_replace($fileExtensionRegExp, $uniqueFileNamePart, $imageFilePath) . '.png';
                } else {
                    $newFilePath = $imageFilePath;
                }
                $endExtension = 'png';
                $imageQuality = intval($imageOptions[1]);
                if ($imageQuality > 9) {
                    $imageQuality = 9;
                }
                if ($imageQuality < 0) {
                    $imageQuality = 0;
                }
                $tmp = WA_DFP_RetainTransparent($src, $tmp, $imageInfo);
                imagepng($tmp, $newFilePath, $imageQuality);
                break;
            case WADFP_JPEG:
                $newFilePath = preg_replace($fileExtensionRegExp, $uniqueFileNamePart, $imageFilePath) . '.jpg';
                $endExtension = 'jpg';
                $imageQuality = intval($imageOptions[1]);
                if ($imageQuality > 100) {
                    $imageQuality = 100;
                }
                if ($imageQuality < 0) {
                    $imageQuality = 0;
                }
                $tmp = resetTransparency($tmp, $options);
                imagejpeg($tmp, $newFilePath, $imageQuality);
                break;
            case WADFP_GIF:
                $newFilePath = preg_replace($fileExtensionRegExp, $uniqueFileNamePart, $imageFilePath) . '.gif';
                $endExtension = 'gif';
                $tmp = WA_DFP_RetainTransparent($src, $tmp, $imageInfo);
                imagegif($tmp, $newFilePath);
                break;
        }
        $endServerPath = $newFilePath;
        $fileSize = filesize($endServerPath);
        $imageInfo = getimagesize($endServerPath);
        $mime = $imageInfo['mime'];
    } else {
        // no conversion
        switch ($imageInfo[2]) {
            case IMAGETYPE_PNG:
                $endServerPath = preg_replace($fileExtensionRegExp, $uniqueFileNamePart, $imageFilePath) . '.png';
                if ($options['ResizeType'] != "0") {
                    imagepng($tmp, $endServerPath);
                } else {
                    copy($imageFilePath, $endServerPath);
                }
                break;
            case IMAGETYPE_JPEG:
                $endServerPath = preg_replace($fileExtensionRegExp, $uniqueFileNamePart, $imageFilePath) . '.jpg';
                if ($options['ResizeType'] != "0") {
                    imagejpeg($tmp, $endServerPath);
                } else {
                    copy($imageFilePath, $endServerPath);
                }
                break;
            case IMAGETYPE_GIF:
                $endServerPath = preg_replace($fileExtensionRegExp, $uniqueFileNamePart, $imageFilePath) . '.gif';
                if ($options['ResizeType'] != "0") {
                    imagegif($tmp, $endServerPath);
                } else {
                    copy($imageFilePath, $endServerPath);
                }
                break;
        }
        $fileSize = filesize($endServerPath);
    }
    if ($src) {
        imagedestroy($src);
    }
    if ($tmp && !$tmpIsSrc) {
        imagedestroy($tmp);
    }
    return array('fileSize' => $fileSize, 'startWidth' => $width, 'startHeight' => $height, 'endWidth' => $newWidth, 'endHeight' => $newHeight, 'startServerPath' => $imageFilePath, 'endServerPath' => $endServerPath, 'startExtension' => $startExtension, 'endExtension' => $endExtension, 'contentType' => $mime);
}
示例#12
0
    if ($color[0] == '#') {
        $color = substr($color, 1);
    }
    if (strlen($color) == 6) {
        list($r, $g, $b) = array($color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5]);
    } elseif (strlen($color) == 3) {
        list($r, $g, $b) = array($color[0], $color[1], $color[2]);
    } else {
        return false;
    }
    $r = hexdec($r);
    $g = hexdec($g);
    $b = hexdec($b);
    return array($r, $g, $b);
}
$rgb = html2rgb($_REQUEST['var_captcha_color']);
$text = randomString(5);
// how many figures will be display
$abspath = getcwd();
$abspath = str_replace("\\", "/", $abspath);
//header('Content-type: image/png');
//error_reporting(E_ALL);
$img = ImageCreateFromPNG('captcha.png');
// background image
$color = ImageColorAllocate($img, $rgb[0], $rgb[1], $rgb[2]);
// color
$ttf = "{$abspath}/xfiles.ttf";
//font type
$ttfsize = 24;
// font size
$angle = rand(0, 5);
function convert_html_color($html)
{
    global $hue, $sat;
    $RGB = html2rgb($html);
    //convert html to rgb
    $HSV = RGB_TO_HSV($RGB[0], $RGB[1], $RGB[2]);
    // convert rgb to hsv, which are percentages
    $huechange = ($hue + 100) / 200;
    //find the percentage change from the imagemagick command
    $newH = $HSV['H'] + $huechange;
    if ($newH > 1) {
        $newH = $newH - 1;
    }
    $newS = $HSV['S'] * ($sat / 100);
    $newRGB = HSV_TO_RGB($newH, $newS, $HSV['V']);
    $newHTML = rgb2html($newRGB['R'], $newRGB['G'], $newRGB['B']);
    return $newHTML;
}
/**
|==========================================================
| Create Captcha
|==========================================================
|
*/
function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '')
{
    $defaults = array('word' => '', 'max_char' => '6', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_path' => '', 'expiration' => 0, 'background' => '#FFFFFF', 'border' => '#CCCCCC', 'text' => '#330099', 'grid' => '#0033CC', 'shadow' => '#330099', 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
    foreach ($defaults as $key => $val) {
        if (!is_array($data)) {
            if (!isset(${$key}) or ${$key} == '') {
                ${$key} = $val;
            }
        } else {
            ${$key} = !isset($data[$key]) ? $val : $data[$key];
        }
    }
    if ($img_path == '' or $img_url == '') {
        return FALSE;
    }
    if (!@is_dir($img_path)) {
        throw new Exception('Captcha path seems is not a directory !');
    }
    if (!common::is_really_writable($img_path)) {
        throw new Exception($img_path . ' Captcha directory is not writeable !');
    }
    if (!extension_loaded('gd')) {
        throw new Exception('Gd extension not found for captcha !');
    }
    // -----------------------------------
    // Remove old images
    // -----------------------------------
    list($usec, $sec) = explode(" ", microtime());
    $now = (double) $usec + (double) $sec;
    $current_dir = @opendir($img_path);
    while ($filename = @readdir($current_dir)) {
        //echo 'file name '.$filename;
        if ($filename != "." and $filename != ".." and $filename != "index.html") {
            $name = str_replace(".jpg", "", $filename);
            if ($name + $expiration < $now) {
                @unlink($img_path . $filename);
            }
        }
    }
    @closedir($current_dir);
    // -----------------------------------
    // Do we have a "word" yet?
    // -----------------------------------
    if ($word == '') {
        $str = '';
        for ($i = 0; $i < $max_char; $i++) {
            $str .= substr($pool, mt_rand(0, strlen($pool) - 1), 1);
        }
        $word = $str;
    }
    // -----------------------------------
    // Determine angle and position
    // -----------------------------------
    $length = strlen($word);
    $angle = $length >= 6 ? rand(-($length - 6), $length - 6) : 0;
    $x_axis = rand(6, 360 / $length - 16);
    $y_axis = $angle >= 0 ? rand($img_height, $img_width) : rand(6, $img_height);
    // -----------------------------------
    // Create image
    // -----------------------------------
    // PHP.net recommends imagecreatetruecolor(), but it isn't always available
    if (function_exists('imagecreatetruecolor')) {
        $im = imagecreatetruecolor($img_width, $img_height);
    } else {
        $im = imagecreate($img_width, $img_height);
    }
    // -----------------------------------
    //  Assign colors
    // -----------------------------------
    $bg = html2rgb($background);
    $bg_color = imagecolorallocate($im, $bg[0], $bg[1], $bg[2]);
    $brd = html2rgb($border);
    $border_color = imagecolorallocate($im, $brd[0], $brd[1], $brd[2]);
    $txt = html2rgb($text);
    $text_color = imagecolorallocate($im, $txt[0], $txt[1], $txt[2]);
    $grd = html2rgb($grid);
    $grid_color = imagecolorallocate($im, $grd[0], $grd[1], $grd[2]);
    $shd = html2rgb($shadow);
    $shadow_color = imagecolorallocate($im, $shd[0], $shd[1], $shd[2]);
    // -----------------------------------
    //  Create the rectangle
    // -----------------------------------
    ImageFilledRectangle($im, 0, 0, $img_width, $img_height, $bg_color);
    // -----------------------------------
    //  Create the spiral pattern
    // -----------------------------------
    $theta = 1;
    $thetac = 7;
    $radius = 16;
    $circles = 8;
    $points = 8;
    for ($i = 0; $i < $circles * $points - 1; $i++) {
        $theta = $theta + $thetac;
        $rad = $radius * ($i / $points);
        $x = $rad * cos($theta) + $x_axis;
        $y = $rad * sin($theta) + $y_axis;
        $theta = $theta + $thetac;
        $rad1 = $radius * (($i + 1) / $points);
        $x1 = $rad1 * cos($theta) + $x_axis;
        $y1 = $rad1 * sin($theta) + $y_axis;
        imageline($im, $x, $y, $x1, $y1, $grid_color);
        $theta = $theta - $thetac;
    }
    // -----------------------------------
    //  Write the text
    // -----------------------------------
    $use_font = ($font_path != '' and file_exists($font_path) and function_exists('imagettftext')) ? TRUE : FALSE;
    if ($use_font == FALSE) {
        $font_size = 12;
        $x = rand(0, $img_width / ($length / 1.5));
        $y = 12;
    } else {
        $font_size = 16;
        $x = rand(0, $img_width / ($length / 1.5));
        $y = $font_size + 2;
    }
    for ($i = 0; $i < strlen($word); $i++) {
        if ($use_font == FALSE) {
            $y = rand(0, $img_height / 2);
            imagestring($im, $font_size, $x, $y, substr($word, $i, 1), $text_color);
            $x += $font_size * 2;
        } else {
            $y = rand($img_height / 2, $img_height - 3);
            imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
            $x += $font_size;
        }
    }
    // -----------------------------------
    //  Create the border
    // -----------------------------------
    imagerectangle($im, 0, 0, $img_width - 1, $img_height - 1, $border_color);
    // -----------------------------------
    //  Generate the image
    // -----------------------------------
    $img_name = $now . '.jpg';
    ImageJPEG($im, $img_path . $img_name);
    $img = "<img src=\"{$img_url}{$img_name}\" width=\"{$img_width}\" height=\"{$img_height}\" style=\"border:0;\" alt=\" \" />";
    ImageDestroy($im);
    return array('word' => $word, 'time' => $now, 'image' => $img);
}
示例#15
0
function processColorSwatch($hex, $ratio = 200)
{
    $tc = html2rgb($hex);
    $diff = coldiff($tc[0], $tc[1], $tc[2], 255, 255, 255);
    if ($diff < $ratio) {
        //use border
        return true;
    } else {
        return false;
    }
}
         $im = imagecreatefromjpeg($filepath);
     } elseif ($filetype == 3) {
         $im = imagecreatefrompng($filepath);
     }
 } else {
     die("FFUUUUUUU");
 }
 $text1 = isset($_GET['text1']) && $_GET['text1'] != '' ? trim(stripinput($_GET['text1'])) : '';
 $text2 = isset($_GET['text2']) && $_GET['text2'] != '' ? trim(stripinput($_GET['text2'])) : '';
 $size1 = isset($_GET['size1']) && isnum($_GET['size1']) && in_array(intval($_GET['size1']), array(12, 16, 24, 32, 48)) ? intval($_GET['size1']) : 32;
 $size2 = isset($_GET['size2']) && isnum($_GET['size2']) && in_array(intval($_GET['size2']), array(12, 16, 24, 32, 48)) ? intval($_GET['size2']) : 32;
 $font1 = isset($_GET['font1']) && isnum($_GET['font1']) && in_array(intval($_GET['font1']), array(1, 2, 3, 4, 5)) ? intval($_GET['font1']) : 1;
 $font2 = isset($_GET['font2']) && isnum($_GET['font2']) && in_array(intval($_GET['font2']), array(1, 2, 3, 4, 5)) ? intval($_GET['font2']) : 1;
 $color1_array = html2rgb($_GET['color1']);
 $color1 = imagecolorallocate($im, $color1_array[0], $color1_array[1], $color1_array[2]);
 $color2_array = html2rgb($_GET['color2']);
 $color2 = imagecolorallocate($im, $color2_array[0], $color2_array[1], $color2_array[2]);
 if ($text1 != '') {
     CenterImageString($im, $gen_type, $image_res[0], $image_res[1], $text1, $size1, $color1, $font1, 1);
 }
 if ($text2 != '') {
     CenterImageString($im, $gen_type, $image_res[0], $image_res[1], $text2, $size2, $color2, $font2, 2);
 }
 if (isset($_GET['action']) && $_GET['action'] == "save") {
     $get_id = dbquery("SELECT mem_id FROM " . DB_GEM_MEMS . " ORDER BY mem_id DESC LIMIT 1");
     if (dbrows($get_id)) {
         $get_id = dbarray($get_id);
         $id = $get_id['mem_id'] + 1;
     } else {
         $id = 1;
     }
示例#17
0
    if ($color[0] == '#') {
        $color = substr($color, 1);
    }
    if (strlen($color) == 6) {
        list($r, $g, $b) = array($color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5]);
    } elseif (strlen($color) == 3) {
        list($r, $g, $b) = array($color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2]);
    } else {
        return false;
    }
    $r = hexdec($r);
    $g = hexdec($g);
    $b = hexdec($b);
    return array($r, $g, $b, $color);
}
$feature_bg = html2rgb($color['feature_bg']);
$feature_bg_Opacity = base_convert($color['feature_bg_Opacity'] * 255, 10, 16);
$font = theme_get_option('font');
$font['font_family'] = stripslashes($font['font_family']);
if ($color['page_h1'] == '') {
    $color['page_h1'] = $color['page_header'];
}
if ($color['page_h2'] == '') {
    $color['page_h2'] = $color['page_header'];
}
if ($color['page_h3'] == '') {
    $color['page_h3'] = $color['page_header'];
}
if ($color['page_h4'] == '') {
    $color['page_h4'] = $color['page_header'];
}
function mathimage($text, $size, $pathtoimg, $color = '#000000', $bg_color = '#ffffff')
{
    /*
    Creates the formula image (if the image is not in the cache) and returns the <img src=...></img> html code.
    */
    global $dirimg, $dirfonts, $mp_debug, $mpfont_red, $mpfont_green, $mpfont_blue, $mpbg_red, $mpbg_green, $mpbg_blue;
    global $_VERSION;
    list($mpfont_red, $mpfont_green, $mpfont_blue) = html2rgb($color);
    list($mpbg_red, $mpbg_green, $mpbg_blue) = html2rgb($bg_color);
    $text = stripslashes($text);
    $size = max($size, 10);
    $size = min($size, 24);
    $nameimg = md5(trim($text) . $size . $color . $bg_color) . '.png';
    $v = detectimg($nameimg);
    if ($v == 0) {
        //the image doesn't exist in the cache directory. we create it.
        $formula = new expression_math(tableau_expression(trim($text)));
        $formula->dessine($size);
        $v = 1000 - imagesy($formula->image) + $formula->base_verticale + 3;
        //1000+baseline ($v) is recorded in the name of the image
        imagepng($formula->image, $dirimg . "/math_" . $v . "_" . $nameimg);
    }
    $valign = $v - 1000;
    $label_text = htmlentities(str_replace('{prime}', "'", $text), ENT_COMPAT, 'UTF-8');
    # encode so html stays valid
    #$label_text = htmlentities(str_replace('{prime}',"'",$text)); # encode so html stays valid
    $text = str_replace("€", '[euro80]', $text);
    $text = str_replace("â82ac", '[euroU]', $text);
    return '<!-- ' . $text . ' --><img src="' . $pathtoimg . "math_" . $v . "_" . $nameimg . '" style="vertical-align:' . $valign . 'px;' . ' display: inline-block ;" alt="' . $label_text . '" title="' . $label_text . '"/>';
}
 $data_point = 0;
 // now that we have the data_size for a single channel (they both will be the same)
 // we can initialize our image canvas
 if (!$img) {
     // create original image width based on amount of detail
     // each waveform to be processed with be $height high, but will be condensed
     // and resized later (if specified)
     $img = imagecreatetruecolor($data_size / DETAIL, $height * sizeof($wavs_to_process));
     // fill background of image
     if ($background == "") {
         // transparent background specified
         imagesavealpha($img, true);
         $transparentColor = imagecolorallocatealpha($img, 0, 0, 0, 127);
         imagefill($img, 0, 0, $transparentColor);
     } else {
         list($br, $bg, $bb) = html2rgb($background);
         imagefilledrectangle($img, 0, 0, (int) ($data_size / DETAIL), $height * sizeof($wavs_to_process), imagecolorallocate($img, $br, $bg, $bb));
     }
 }
 while (!feof($handle) && $data_point < $data_size) {
     if ($data_point++ % DETAIL == 0) {
         $bytes = array();
         // get number of bytes depending on bitrate
         for ($i = 0; $i < $byte; $i++) {
             $bytes[$i] = fgetc($handle);
         }
         switch ($byte) {
             // get value for 8-bit wav
             case 1:
                 $data = findValues($bytes[0], $bytes[1]);
                 break;
示例#20
0
function mp3toWavForm($fname, $width = 500, $height = 50, $foreground = '#E2E2FF', $background = '#000000', $detail = 3)
{
    $fileInfo = new SplFileInfo($fname);
    $finalFilename = preg_split('/\\./', $fileInfo->getFilename());
    $finalFilename = md5($finalFilename[0]) . '.png';
    /**
     * PROCESS THE FILE
     */
    // temporary file name
    $tmpname = substr(md5(time()), 0, 10);
    // copy from temp upload directory to current
    copy($fname, "{$tmpname}_o.mp3");
    /**
     * convert mp3 to wav using lame decoder
     * First, resample the original mp3 using as mono (-m m), 16 bit (-b 16), and 8 KHz (--resample 8)
     * Secondly, convert that resampled mp3 into a wav
     * We don't necessarily need high quality audio to produce a waveform, doing this process reduces the WAV
     * to it's simplest form and makes processing significantly faster
     */
    exec("lame.exe {$tmpname}_o.mp3 -f -m m -b 16 --resample 8 {$tmpname}.mp3 && lame --decode {$tmpname}.mp3 {$tmpname}.wav");
    // delete temporary files
    @unlink("{$tmpname}_o.mp3");
    @unlink("{$tmpname}.mp3");
    $filename = "{$tmpname}.wav";
    /**
     * Below as posted by "zvoneM" on
     * http://forums.devshed.com/php-development-5/reading-16-bit-wav-file-318740.html
     * as findValues() defined above
     * Translated from Croation to English - July 11, 2011
     */
    $handle = fopen($filename, "r");
    //dohvacanje zaglavlja wav datoteke
    $heading[] = fread($handle, 4);
    $heading[] = bin2hex(fread($handle, 4));
    $heading[] = fread($handle, 4);
    $heading[] = fread($handle, 4);
    $heading[] = bin2hex(fread($handle, 4));
    $heading[] = bin2hex(fread($handle, 2));
    $heading[] = bin2hex(fread($handle, 2));
    $heading[] = bin2hex(fread($handle, 4));
    $heading[] = bin2hex(fread($handle, 4));
    $heading[] = bin2hex(fread($handle, 2));
    $heading[] = bin2hex(fread($handle, 2));
    $heading[] = fread($handle, 4);
    $heading[] = bin2hex(fread($handle, 4));
    //bitrate wav datoteke
    $peek = hexdec(substr($heading[10], 0, 2));
    $byte = $peek / 8;
    //provjera da li se radi o mono ili stereo wavu
    $channel = hexdec(substr($heading[6], 0, 2));
    if ($channel == 2) {
        $omjer = 40;
    } else {
        $omjer = 80;
    }
    while (!feof($handle)) {
        $bytes = array();
        //get number of bytes depending on bitrate
        for ($i = 0; $i < $byte; $i++) {
            $bytes[$i] = fgetc($handle);
        }
        switch ($byte) {
            //get value for 8-bit wav
            case 1:
                $data[] = findValues($bytes[0], $bytes[1]);
                break;
                //get value for 16-bit wav
            //get value for 16-bit wav
            case 2:
                if (ord($bytes[1]) & 128) {
                    $temp = 0;
                } else {
                    $temp = 128;
                }
                $temp = chr((ord($bytes[1]) & 127) + $temp);
                $data[] = floor(findValues($bytes[0], $temp) / 256);
                break;
        }
        //skip bytes for memory optimization
        fread($handle, $omjer);
    }
    // close and cleanup
    fclose($handle);
    unlink("{$tmpname}.wav");
    /**
     * Image generation
     */
    // header("Content-Type: image/png");
    // how much detail we want. Larger number means less detail
    // (basically, how many bytes/frames to skip processing)
    // the lower the number means longer processing time
    // get user vars from form
    // create original image width based on amount of detail
    $img = imagecreatetruecolor(sizeof($data) / $detail, $height);
    // fill background of image
    list($r, $g, $b) = html2rgb($background);
    imagefilledrectangle($img, 0, 0, sizeof($data) / $detail, $height, imagecolorallocate($img, $r, $g, $b));
    // generate background color
    list($r, $g, $b) = html2rgb($foreground);
    // loop through frames/bytes of wav data as genearted above
    for ($d = 0; $d < sizeof($data); $d += $detail) {
        // relative value based on height of image being generated
        // data values can range between 0 and 255
        $v = (int) ($data[$d] / 255 * $height);
        // draw the line on the image using the $v value and centering it vertically on the canvas
        imageline($img, $d / $detail, 0 + ($height - $v), $d / $detail, $height - ($height - $v), imagecolorallocate($img, $r, $g, $b));
    }
    //create file
    $fp = fopen('images/' . $finalFilename, 'w');
    fclose($fp);
    // want it resized?
    if ($width) {
        // resample the image to the proportions defined in the form
        $rimg = imagecreatetruecolor($width, $height);
        imagecopyresampled($rimg, $img, 0, 0, 0, 0, $width, $height, sizeof($data) / $detail, $height);
        imagepng($rimg, 'images/' . $finalFilename);
        imagedestroy($rimg);
    } else {
        // print out at it's raw width (size of $data / detail level)
        imagepng($img, 'images/' . $finalFilename);
        imagedestroy($img);
    }
    return 'images/' . $finalFilename;
}
示例#21
0
function mp3_waveform($fname, $width, $height, $foreground, $background)
{
    /**
     * PROCESS THE FILE
     */
    // temporary file name
    $tmpname = '/tmp/' . substr(md5(time()), 0, 10);
    // copy from temp upload directory to current
    copy($fname, "{$tmpname}_o.mp3");
    $imagename = preg_replace('%^(.*)\\.[^.]+$%', '\\1-wave', $fname) . '.png';
    /**
     * convert mp3 to wav using lame decoder
     * First, resample the original mp3 using as mono (-m m), 16 bit (-b 16), and 8 KHz (--resample 8)
     * Secondly, convert that resampled mp3 into a wav
     * We don't necessarily need high quality audio to produce a waveform, doing this process reduces the WAV
     * to it's simplest form and makes processing significantly faster
     */
    //exec("/usr/local/bin/lame {$tmpname}_o.mp3 --quiet -f -m s -b 64 --resample 8 {$tmpname}.mp3 &&"
    //	." /usr/local/bin/lame --quiet --decode {$tmpname}.mp3 {$tmpname}.wav");
    exec("/usr/local/bin/sox --norm {$tmpname}_o.mp3 -r 8k -b 8 -e unsigned -c 2 {$tmpname}.wav");
    // delete temporary files
    @unlink("{$tmpname}_o.mp3");
    //@unlink("{$tmpname}.mp3");
    $filename = "{$tmpname}.wav";
    if (!file_exists($filename)) {
        print "Error: WAV file not generated. Please verify directory write and execute permissions.";
        exit;
    }
    /**
     * Below as posted by "zvoneM" on
     * http://forums.devshed.com/php-development-5/reading-16-bit-wav-file-318740.html
     * as findValues() defined above
     * Translated from Croation to English - July 11, 2011
     */
    $handle = fopen($filename, "r");
    // format: see http://web.archive.org/web/19991115123323/http://www.borg.com/~jglatt/tech/wave.htm
    $heading[0] = fread($handle, 4);
    // "RIFF"
    $heading[1] = bin2hex(fread($handle, 4));
    // lSize
    $heading[2] = fread($handle, 4);
    // "WAVE"
    $heading[3] = fread($handle, 4);
    // "fmt " (format chunk)
    $heading[4] = bin2hex(fread($handle, 4));
    // lChunkSize
    $heading[5] = bin2hex(fread($handle, 2));
    // wFormatTag (=1)
    $heading[6] = bin2hex(fread($handle, 2));
    // wChannels (=2 for stereo)
    $heading[7] = bin2hex(fread($handle, 4));
    // dwSamplesPerSec
    $heading[8] = bin2hex(fread($handle, 4));
    // dwAvgBytesPerSec
    $heading[9] = bin2hex(fread($handle, 2));
    // wBlockAlign
    $heading[10] = bin2hex(fread($handle, 2));
    // wBitsPerSample
    $heading[11] = fread($handle, 4);
    // "data"
    $heading[12] = bin2hex(fread($handle, 4));
    // lChunkSize
    //bitrate wav datoteke
    $peek = hexdec(substr($heading[10], 0, 2));
    $byte = $peek / 8;
    //provjera da li se radi o mono ili stereo wavu
    $channel = hexdec(substr($heading[6], 0, 2));
    $datasize = hexdec(substr($heading[12], 6, 2) . substr($heading[12], 4, 2) . substr($heading[12], 2, 2) . substr($heading[12], 0, 2));
    $omjer = floor($datasize / 512 / 4);
    error_log('data size = ' . $datasize . ' (' . $heading[12] . ') / omjer = ' . $omjer);
    //if($channel == 2){
    //  $omjer = 40;
    //}
    //else{
    //  $omjer = 80;
    //}
    //error_log('channels: '.$channel);
    while (!feof($handle)) {
        for ($ch = 0; $ch < $channel; $ch++) {
            $bytes = array();
            //get number of bytes depending on bitrate
            for ($i = 0; $i < $byte; $i++) {
                $bytes[$i] = fgetc($handle);
            }
            switch ($byte) {
                //get value for 8-bit wav
                case 1:
                    $data[$ch][] = abs(findValues($bytes[0], $bytes[1]) - 128);
                    break;
                    //get value for 16-bit wav
                //get value for 16-bit wav
                case 2:
                    if (ord($bytes[1]) & 128) {
                        $temp = 0;
                    } else {
                        $temp = 128;
                    }
                    $temp = chr((ord($bytes[1]) & 127) + $temp);
                    $data[$ch][] = abs(floor(findValues($bytes[0], $temp) / 256) - 128);
                    break;
            }
        }
        //skip bytes for memory optimization
        fread($handle, $omjer);
    }
    // close and cleanup
    fclose($handle);
    unlink("{$tmpname}.wav");
    /**
     * Image generation
     */
    // how much detail we want. Larger number means less detail
    // (basically, how many bytes/frames to skip processing)
    // the lower the number means longer processing time
    $size = sizeof($data[0]);
    $step = min(array(1, 2 * round($size / $width)));
    //1
    // create original image width based on amount of detail
    $img = imagecreatetruecolor($size / $step, $height);
    // fill background of image
    if ($background == "") {
        imagesavealpha($img, true);
        $transparentColor = imagecolorallocatealpha($img, 0, 0, 0, 127);
        imagefill($img, 0, 0, $transparentColor);
    } else {
        list($r, $g, $b) = html2rgb($background);
        imagefilledrectangle($img, 0, 0, $size / $step, $height, imagecolorallocate($img, $r, $g, $b));
    }
    // generate foreground color
    list($r, $g, $b) = html2rgb($foreground);
    //error_log('size:'.$size);
    if ($size < $width) {
        $thickness = 1;
    } else {
        $thickness = $size / ($width * 2);
    }
    imagesetthickness($img, $thickness);
    $mx = 0;
    for ($d = 0; $d < $size; $d += $step) {
        if (abs($data[0][$d]) > $mx) {
            $mx = abs($data[0][$d]);
        }
        if (abs($data[1][$d]) > $mx) {
            $mx = abs($data[1][$d]);
        }
    }
    $mx *= 1.1;
    // loop through frames/bytes of wav data as genearted above
    for ($d = 0; $d < $size; $d += $step) {
        // relative value based on height of image being generated
        // data values can range between 0 and 255
        $c1 = (int) ($data[0][$d] * $height / 2 / $mx);
        $c2 = (int) ($data[1][$d] * $height / 2 / $mx);
        //error_log('L='.$data[0][$d].' / R='.$data[1][$d]);
        // draw the line on the image using the $v value and centering it vertically on the canvas
        //imageline($img, $d / $step, round($c1), $d / $step, round($height-$c2), imagecolorallocate($img, $r, $g, $b));
        imageline($img, $d / $step, $height / 2, $d / $step, $height / 2 - $c1, imagecolorallocate($img, $r, $g, $b));
        imageline($img, $d / $step, $height / 2, $d / $step, $height / 2 + $c2, imagecolorallocate($img, $r, $g, $b));
    }
    // want it resized?
    if ($width) {
        // resample the image to the proportions defined in the form
        $rimg = imagecreatetruecolor($width, $height);
        // save alpha from original image
        imagesavealpha($rimg, true);
        imagealphablending($rimg, false);
        // copy to resized
        imagecopyresampled($rimg, $img, 0, 0, 0, 0, $width, $height, $size / $step, $height);
        imagepng($rimg, $imagename);
        imagedestroy($rimg);
    } else {
        // print out at it's raw width (size of $data / detail level)
        imagepng($img, $imagename);
        imagedestroy($img);
    }
    unset($data);
    return $imagename;
}
示例#22
0
    }
    */
    $_SESSION['searchForm']['inSearch'] = true;
}
// Color search passed
if ($_REQUEST['hex']) {
    //if(!$_SESSION['searchForm']['keywords']) $_SESSION['searchForm']['allFields'] = false;
    $_SESSION['searchForm']['searchSortBy'] = 'color';
    //unset($_SESSION['searchForm']['resultsArray']); // Clear any previous results array
    $_SESSION['searchForm']['hex'] = $_REQUEST['hex'];
    if ($_REQUEST['red']) {
        $_SESSION['searchForm']['red'] = $_REQUEST['red'];
        $_SESSION['searchForm']['green'] = $_REQUEST['green'];
        $_SESSION['searchForm']['blue'] = $_REQUEST['blue'];
    } else {
        $rgbColor = html2rgb($_REQUEST['hex']);
        // Convert hex to rgb
        $_SESSION['searchForm']['red'] = $rgbColor['red'];
        $_SESSION['searchForm']['green'] = $rgbColor['green'];
        $_SESSION['searchForm']['blue'] = $rgbColor['blue'];
    }
    $_SESSION['searchForm']['inSearch'] = true;
}
// Orientation search passed
if ($_REQUEST['orientations']) {
    //unset($_SESSION['searchForm']['resultsArray']); // Clear any previous results array
    unset($_SESSION['searchForm']['orientations']);
    // Clear ori first
    foreach ($_REQUEST['orientations'] as $key => $value) {
        $_SESSION['searchForm']['orientations'][$key] = $value;
    }
示例#23
0
 function GetOverview()
 {
     $this->MakeSafe();
     $statusarray = array();
     // check to see if map was set
     if (strlen($this->DrawingFileName)) {
         $mapfile = "drawings" . DIRECTORY_SEPARATOR . $this->DrawingFileName;
         $overview = array();
         $space = array();
         $weight = array();
         $power = array();
         $temperature = array();
         $humidity = array();
         $realpower = array();
         $colors = array();
         // map was set in config check to ensure a file exists before we attempt to use it
         if (file_exists($mapfile)) {
             $this->dcconfig = new Config();
             $dev = new Device();
             $templ = new DeviceTemplate();
             $cab = new Cabinet();
             // get all color codes and limits for use with loop below
             $CriticalColor = html2rgb($this->dcconfig->ParameterArray["CriticalColor"]);
             $CautionColor = html2rgb($this->dcconfig->ParameterArray["CautionColor"]);
             $GoodColor = html2rgb($this->dcconfig->ParameterArray["GoodColor"]);
             $SpaceRed = intval($this->dcconfig->ParameterArray["SpaceRed"]);
             $SpaceYellow = intval($this->dcconfig->ParameterArray["SpaceYellow"]);
             $WeightRed = intval($this->dcconfig->ParameterArray["WeightRed"]);
             $WeightYellow = intval($this->dcconfig->ParameterArray["WeightYellow"]);
             $PowerRed = intval($this->dcconfig->ParameterArray["PowerRed"]);
             $PowerYellow = intval($this->dcconfig->ParameterArray["PowerYellow"]);
             $unknown = html2rgb('FFFFFF');
             // Copy all colors into an array to export
             $color['unk'] = array('r' => $unknown[0], 'g' => $unknown[1], 'b' => $unknown[2]);
             $color['bad'] = array('r' => $CriticalColor[0], 'g' => $CriticalColor[1], 'b' => $CriticalColor[2]);
             $color['med'] = array('r' => $CautionColor[0], 'g' => $CautionColor[1], 'b' => $CautionColor[2]);
             $color['low'] = array('r' => $GoodColor[0], 'g' => $GoodColor[1], 'b' => $GoodColor[2]);
             $colors = $color;
             // Assign color variables
             $CriticalColor = 'bad';
             $CautionColor = 'med';
             $GoodColor = 'low';
             $unknownColor = 'unk';
             // Temperature
             $TemperatureYellow = intval($this->dcconfig->ParameterArray["TemperatureYellow"]);
             $TemperatureRed = intval($this->dcconfig->ParameterArray["TemperatureRed"]);
             // Humidity
             $HumidityMin = intval($this->dcconfig->ParameterArray["HumidityRedLow"]);
             $HumidityMedMin = intval($this->dcconfig->ParameterArray["HumidityYellowLow"]);
             $HumidityMedMax = intval($this->dcconfig->ParameterArray["HumidityYellowHigh"]);
             $HumidityMax = intval($this->dcconfig->ParameterArray["HumidityRedHigh"]);
             //Real Power
             $RealPowerRed = intval($this->dcconfig->ParameterArray["PowerRed"]);
             $RealPowerYellow = intval($this->dcconfig->ParameterArray["PowerYellow"]);
             // get image file attributes and type
             list($width, $height, $type, $attr) = getimagesize($mapfile);
             $cdus = array();
             $sql = "select c.CabinetID, P.RealPower, P.BreakerSize, P.InputAmperage*PP.PanelVoltage as VoltAmp from \n\t\t\t\t\t(fac_Cabinet c left join (select CabinetID, Wattage as RealPower, BreakerSize, InputAmperage, PanelID from fac_PowerDistribution PD \n\t\t\t\t\tleft join fac_PDUStats PS on PD.PDUID=PS.PDUID) P on c.CabinetID=P.CabinetID) \n\t\t\t\t\tleft join (select PanelVoltage, PanelID from fac_PowerPanel) PP on PP.PanelID=P.PanelID \n\t\t\t\t\twhere PanelVoltage is not null and RealPower is not null and c.DataCenterID=" . intval($this->DataCenterID);
             $rpvalues = $this->query($sql);
             foreach ($rpvalues as $cduRow) {
                 $cabid = $cduRow['CabinetID'];
                 $voltamp = $cduRow['VoltAmp'];
                 $rp = $cduRow['RealPower'];
                 $bs = $cduRow['BreakerSize'];
                 if ($bs == 1) {
                     $maxDraw = $voltamp / 1.732;
                 } elseif ($bs == 2) {
                     $maxDraw = $voltamp;
                 } else {
                     $maxDraw = $voltamp * 1.732;
                 }
                 // De-rate all breakers to 80% sustained load
                 $maxDraw *= 0.8;
                 // Only keep the highest percentage of any single CDU in a cabinet
                 if ($rp > 0) {
                     $pp = intval($rp / $maxDraw * 100);
                 } else {
                     $pp = 0;
                 }
                 $cdus[$cabid] = isset($cdus[$cabid]) && $cdus[$cabid] > $pp ? $cdus[$cabid] : $pp;
             }
             $cab->DataCenterID = $this->DataCenterID;
             $cabList = $cab->ListCabinetsByDC();
             $titletemp = 0;
             $titlerp = 0;
             // read all cabinets and calculate the color to display on the cabinet
             foreach ($cabList as $cabRow) {
                 if ($cabRow->MapX1 == $cabRow->MapX2 || $cabRow->MapY1 == $cabRow->MapY2) {
                     continue;
                 }
                 $currentHeight = $cabRow->CabinetHeight;
                 $metrics = CabinetMetrics::getMetrics($cabRow->CabinetID);
                 $currentTemperature = $metrics->IntakeTemperature;
                 $currentHumidity = $metrics->IntakeHumidity;
                 $currentRealPower = $metrics->MeasuredPower;
                 $used = $metrics->SpaceUsed;
                 // check to make sure the cabinet height is set to keep errors out of the logs
                 if (!isset($cabRow->CabinetHeight) || $cabRow->CabinetHeight == 0) {
                     $SpacePercent = 100;
                 } else {
                     $SpacePercent = number_format($metrics->SpaceUsed / $cabRow->CabinetHeight * 100, 0);
                 }
                 // check to make sure there is a weight limit set to keep errors out of logs
                 if (!isset($cabRow->MaxWeight) || $cabRow->MaxWeight == 0) {
                     $WeightPercent = 0;
                 } else {
                     $WeightPercent = number_format($metrics->CalculatedWeight / $cabRow->MaxWeight * 100, 0);
                 }
                 // check to make sure there is a kilowatt limit set to keep errors out of logs
                 if (!isset($cabRow->MaxKW) || $cabRow->MaxKW == 0) {
                     $PowerPercent = 0;
                 } else {
                     $PowerPercent = number_format($metrics->CalculatedPower / 1000 / $cabRow->MaxKW * 100, 0);
                 }
                 if (!isset($cabRow->MaxKW) || $cabRow->MaxKW == 0) {
                     $RealPowerPercent = 0;
                 } else {
                     $RealPowerPercent = number_format($metrics->MeasuredPower / 1000 / $cabRow->MaxKW * 100, 0, ",", ".");
                 }
                 // check for individual cdu's being weird
                 if (isset($cdus[$cab->CabinetID])) {
                     $RealPowerPercent = $RealPowerPercent > $cdus[$cab->CabinetID] ? $RealPowerPercent : $cdus[$cab->CabinetID];
                 }
                 //Decide which color to paint on the canvas depending on the thresholds
                 if ($SpacePercent > $SpaceRed) {
                     $scolor = $CriticalColor;
                 } elseif ($SpacePercent > $SpaceYellow) {
                     $scolor = $CautionColor;
                 } else {
                     $scolor = $GoodColor;
                 }
                 if ($WeightPercent > $WeightRed) {
                     $wcolor = $CriticalColor;
                 } elseif ($WeightPercent > $WeightYellow) {
                     $wcolor = $CautionColor;
                 } else {
                     $wcolor = $GoodColor;
                 }
                 if ($PowerPercent > $PowerRed) {
                     $pcolor = $CriticalColor;
                 } elseif ($PowerPercent > $PowerYellow) {
                     $pcolor = $CautionColor;
                 } else {
                     $pcolor = $GoodColor;
                 }
                 if ($RealPowerPercent > $RealPowerRed) {
                     $rpcolor = $CriticalColor;
                 } elseif ($RealPowerPercent > $RealPowerYellow) {
                     $rpcolor = $CautionColor;
                 } else {
                     $rpcolor = $GoodColor;
                 }
                 if ($currentTemperature == 0) {
                     $tcolor = $unknownColor;
                 } elseif ($currentTemperature > $TemperatureRed) {
                     $tcolor = $CriticalColor;
                 } elseif ($currentTemperature > $TemperatureYellow) {
                     $tcolor = $CautionColor;
                 } else {
                     $tcolor = $GoodColor;
                 }
                 if ($currentHumidity == 0) {
                     $hcolor = $unknownColor;
                 } elseif ($currentHumidity > $HumidityMax || $currentHumidity < $HumidityMin) {
                     $hcolor = $CriticalColor;
                 } elseif ($currentHumidity > $HumidityMedMax || $currentHumidity < $HumidityMedMin) {
                     $hcolor = $CautionColor;
                 } else {
                     $hcolor = $GoodColor;
                 }
                 foreach (array($scolor, $wcolor, $pcolor, $tcolor, $hcolor, $rpcolor) as $cc) {
                     if ($cc == 'bad') {
                         $color = 'bad';
                         break;
                     } elseif ($cc == 'med') {
                         $color = 'med';
                         break;
                     } else {
                         $color = 'low';
                     }
                 }
                 $overview[$cabRow->CabinetID] = $color;
                 $space[$cabRow->CabinetID] = $scolor;
                 $weight[$cabRow->CabinetID] = $wcolor;
                 $power[$cabRow->CabinetID] = $pcolor;
                 $temperature[$cabRow->CabinetID] = $tcolor;
                 $humidity[$cabRow->CabinetID] = $hcolor;
                 $realpower[$cabRow->CabinetID] = $rpcolor;
                 $airflow[$cabRow->CabinetID] = $cabRow->FrontEdge;
             }
         }
         $tempSQL = "select max(LastRead) as ReadingTime from fac_SensorReadings where DeviceID in (select DeviceID from fac_Device where DeviceType='Sensor' and Cabinet in (select CabinetID from fac_Cabinet where DataCenterID=" . $this->DataCenterID . "))";
         $tempRes = $this->query($tempSQL);
         $tempRow = $tempRes->fetch();
         $pwrSQL = "select max(LastRead) as ReadingTime from fac_PDUStats where PDUID in (select DeviceID from fac_Device where DeviceType='CDU' and Cabinet in (select CabinetID from fac_Cabinet where DataCenterID=" . $this->DataCenterID . "))";
         $pwrRes = $this->query($pwrSQL);
         $pwrRow = $pwrRes->fetch();
         //Key
         $overview['title'] = __("Composite View of Cabinets");
         $space['title'] = __("Occupied Space");
         $weight['title'] = __("Calculated Weight");
         $power['title'] = __("Calculated Power Usage");
         $temperature['title'] = $tempRow["ReadingTime"] > 0 ? __("Measured on") . " " . date('c', strtotime($tempRow["ReadingTime"])) : __("no data");
         $humidity['title'] = $tempRow["ReadingTime"] > 0 ? __("Measured on") . " " . date('c', strtotime($tempRow["ReadingTime"])) : __("no data");
         $realpower['title'] = $pwrRow["ReadingTime"] > 0 ? __("Measured on") . " " . date('c', strtotime($pwrRow["ReadingTime"])) : __("no data");
         $airflow['title'] = __("Air Flow");
         $statusarray = array('overview' => $overview, 'space' => $space, 'weight' => $weight, 'power' => $power, 'humidity' => $humidity, 'temperature' => $temperature, 'realpower' => $realpower, 'airflow' => $airflow, 'colors' => $colors);
     }
     return $statusarray;
 }
示例#24
0
if ($thumbSize > 400) {
    $font = 5;
}
$fontWidth = imagefontwidth($font);
$fontHeight = imagefontheight($font);
$thumbTop = $fontHeight + $rowMargin;
$bgcolor = '000000';
$color = 'ffffff';
if (array_key_exists('bg', $_GET)) {
    $bgcolor = $_GET['bg'];
}
if (array_key_exists('text', $_GET)) {
    $color = $_GET['text'];
}
$bgcolor = html2rgb($bgcolor);
$color = html2rgb($color);
// go through each of the tests and figure out the width/height
$columnWidth = 0;
foreach ($tests as &$test) {
    if ($test['video']['width'] && $test['video']['height']) {
        if ($test['video']['width'] > $test['video']['height']) {
            $test['video']['thumbWidth'] = $thumbSize;
            $test['video']['thumbHeight'] = (int) ((double) $thumbSize / (double) $test['video']['width'] * (double) $test['video']['height']);
        } else {
            $test['video']['thumbHeight'] = $thumbSize;
            $test['video']['thumbWidth'] = (int) ((double) $thumbSize / (double) $test['video']['height'] * (double) $test['video']['width']);
        }
        if ($test['video']['thumbWidth'] > $columnWidth) {
            $columnWidth = $test['video']['thumbWidth'];
        }
    }
            $path = BASE_PATH . "/assets/library/{$folderName}/thumbs/{$thumbInfo[thumb_filename]}";
            // xxxxxx No encryption detection
            //$image = new imagetools($path);
            //$colorPalette = $image->colorPalette(10,5);
            if ($config['cpResults'] > 0) {
                $colors = $colorPalette->Get_Color($path, $config['cpResults'], $config['cpReduceBrightness'], $config['cpReduceGradients'], $config['cpDelta']);
            }
            @mysqli_query($db, "DELETE FROM {$dbinfo[pre]}color_palettes WHERE media_id = '{$media[media_id]}'");
            // Delete old color palette first - just in case
            if (count($colors) > 0) {
                echo "Updated: {$media[media_id]}<br>";
                // Save color palette
                foreach ($colors as $hex => $percentage) {
                    if ($percentage > 0) {
                        $percentage = round($percentage, 6);
                        $rgb = html2rgb($hex);
                        echo "{$hex} - rgb({$rgb[red]},{$rgb[green]},{$rgb[blue]}) - {$percentage}<br>";
                        mysqli_query($db, "\r\n\t\t\t\t\t\t\t\tINSERT INTO {$dbinfo[pre]}color_palettes (\r\n\t\t\t\t\t\t\t\tmedia_id,\r\n\t\t\t\t\t\t\t\thex,\r\n\t\t\t\t\t\t\t\tred,\r\n\t\t\t\t\t\t\t\tgreen,\r\n\t\t\t\t\t\t\t\tblue,\r\n\t\t\t\t\t\t\t\tpercentage\r\n\t\t\t\t\t\t\t\t) VALUES (\r\n\t\t\t\t\t\t\t\t'{$media[media_id]}',\r\n\t\t\t\t\t\t\t\t'{$hex}',\r\n\t\t\t\t\t\t\t\t'{$rgb[red]}',\r\n\t\t\t\t\t\t\t\t'{$rgb[green]}',\r\n\t\t\t\t\t\t\t\t'{$rgb[blue]}',\r\n\t\t\t\t\t\t\t\t'{$percentage}')\r\n\t\t\t\t\t\t\t");
                    }
                }
                //print_r($thumbInfo);
                echo "<br><br>";
                $x++;
            }
        }
    }
} catch (Exception $e) {
    die($e->getMessage());
}
if ($db) {
    mysqli_close($db);
示例#26
0
    function shortcode_handler($atts, $content = null)
    {
        $args = $this->getPreparedAtts($atts, $content);
        // Extract args into variables
        extract($this->getPreparedAtts($atts, $content));
        // Generate a Unique ID for the Element
        $element_id = uniqid('testimonial_');
        // Fix integers.
        if (isset($args['limit'])) {
            $args['limit'] = intval($args['limit']);
        }
        if (isset($args['id'])) {
            $args['id'] = intval($args['id']);
        }
        if (isset($args['size']) && 0 < intval($args['size'])) {
            $args['size'] = intval($args['size']);
        }
        //		if (isset($args['category']) && is_numeric($args['category'])) $args['category'] = intval($args['category']);
        // Fix booleans.
        foreach (array('display_url', 'pagination') as $k => $v) {
            if (isset($args[$v]) && 'true' == $args[$v]) {
                $args[$v] = true;
            } else {
                $args[$v] = false;
            }
        }
        $args['display_author'] = true;
        $args['display_avatar'] = false;
        // Generate Testimonial
        ob_start();
        $style_class = '';
        if (isset($style)) {
            $style_class = 'testimonial-shortcode-style-' . $style;
        }
        echo '<div class="testimonial-shortcode ' . $style_class . '" id="' . $element_id . '">';
        do_action('adap_testimonials', $args);
        echo '</div>';
        $ret_val = ob_get_contents();
        ob_end_clean();
        global $custom_css;
        ob_start();
        ?>

		<?php 
        if (isset($text_color)) {
            ?>
		#<?php 
            echo $element_id;
            ?>
 .testimonials-text {
		color: <?php 
            echo $text_color;
            ?>
;
		}
	<?php 
        }
        ?>

		<?php 
        if (isset($background_color)) {
            ?>
		#<?php 
            echo $element_id;
            ?>
 .testimonials-text {
		background: <?php 
            echo $background_color;
            ?>
;
		<?php 
            if (isset($opacity) && $opacity != '1') {
                //convert background color to hex
                $rgb = html2rgb($background_color);
                printf('background: rgba( %s, %s, %s, %s);', $rgb[0], $rgb[1], $rgb[2], $opacity);
            }
            ?>
		}
		#<?php 
            echo $element_id;
            ?>
 .testimonials-text .arrow-down {
		border-top-color: <?php 
            echo $background_color;
            ?>
;

		<?php 
            if (isset($opacity) && $opacity != '1') {
                //convert background color to hex
                echo 'opacity: ' . $opacity . ';';
            }
            ?>

		}
	<?php 
        }
        ?>

		<?php 
        if (isset($author_name_color)) {
            ?>
		#<?php 
            echo $element_id;
            ?>
 .author-name,
		#<?php 
            echo $element_id;
            ?>
 .testimonial-shortcode-user-icon,
		#<?php 
            echo $element_id;
            ?>
 .testimonial-shortcode-user-chevron {
		color: <?php 
            echo $author_name_color;
            ?>
;
		}
	<?php 
        }
        ?>

		<?php 
        if (isset($author_title_color)) {
            ?>
		#<?php 
            echo $element_id;
            ?>
 .author-title {
		color: <?php 
            echo $author_title_color;
            ?>
;
		}
	<?php 
        }
        ?>


		<?php 
        $custom_css .= ob_get_contents();
        ob_end_clean();
        // Return the shortcode
        return $ret_val;
    }
         $room_id = mysql_result($r2, 0, "room_id");
         $q = "SELECT name, surname, color FROM residents WHERE resident_id={$resident_id}";
         $r3 = mysql_query($q);
         /*
         $resident_name=@mysql_result($r3,0,"name");
         $resident_name_surname=@mysql_result($r3,0,"name")." ".@mysql_result($r3,0,"surname");			
         $surname=@mysql_result($r3,0,"surname");			
         */
         $color = mysql_result($r3, 0, "color");
         $surname = mysql_result($r3, 0, "surname");
         $name = mysql_result($r3, 0, "name");
         if ($surname == "") {
             $surname = mysql_result($r3, 0, "name");
             $name = "";
         }
         $arrRGBcolors = html2rgb($color);
         $pdf->SetFillColor($arrRGBcolors[0], $arrRGBcolors[1], $arrRGBcolors[2]);
     }
     $q = "SELECT room FROM rooms WHERE room_id={$data[room_id]}";
     $r3 = mysql_query($q);
     $room = mysql_result($r3, 0, "room");
     //$pdf->Cell(6,3,substr($surname,0,5),$border,0,'C',true);
     if (!mysql_num_rows($r2)) {
         // FREE ROOM
         $pdf->Cell(4.4, 2.8, $room, $border, 0, 'C', true);
     } else {
         // BUSY ROOM
         $pdf->Cell(4.4, 2.8, substr($surname, 0, 3), $border, 0, 'C', true);
     }
 }
 $pdf->Ln();