You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
793 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. $FILE = fopen( 'no-signal_h.png', "rb" );
  3. $idx = 0;
  4. $CL = array();
  5. $CC = array();
  6. $cnt = 0;
  7. while( !feof( $FILE ) ){
  8. if( ( $byte = fread( $FILE, 1 ) ) !== false ){
  9. $OO = bin2hex($byte);
  10. if( strlen( $OO ) == 2 ){
  11. $cnt++;
  12. $CC[$idx] = '0x'. $OO;
  13. $idx++;
  14. if( ( $idx % 16 ) == 0 ){
  15. $CL[] = implode( ',', $CC );
  16. $idx = 0;
  17. };
  18. };
  19. };
  20. };
  21. fclose( $FILE );
  22. if( $idx ){
  23. $BL = array();
  24. for( $i = 0; $i < $idx; $i++ ){
  25. $BL[$i] = $CC[$i];
  26. };
  27. $CL[] = implode( ',', $BL );
  28. };
  29. echo "const unsigned char no_frame_png_1600x900[{$cnt}] = {\n";
  30. $id = 0;
  31. foreach( $CL as $C ){
  32. $id++;
  33. if( $id < count( $CL ) ){
  34. echo "\t" . $C . ",\n";
  35. } else {
  36. echo "\t" . $C . "\n";
  37. };
  38. };
  39. echo "};\n";
  40. ?>