info:wallbox_conversion_blog
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
info:wallbox_conversion_blog [2015/05/08 08:23] – 174.97.189.204 | info:wallbox_conversion_blog [2015/05/08 08:29] (current) – 174.97.189.204 | ||
---|---|---|---|
Line 55: | Line 55: | ||
I then used some more throw-away code to populate these with the track info. That throw-away code is here. Again, don’t judge! | I then used some more throw-away code to populate these with the track info. That throw-away code is here. Again, don’t judge! | ||
- | |||
- | <? | ||
- | |||
- | $tracks = require(' | ||
- | |||
- | usort($tracks, | ||
- | if (isset($a[' | ||
- | return 1; | ||
- | } | ||
- | if (isset($b[' | ||
- | return -1; | ||
- | } | ||
- | |||
- | if ($a[' | ||
- | return strcmp($a[' | ||
- | } | ||
- | |||
- | return strcmp($a[' | ||
- | }); | ||
- | |||
- | $tracks = array_values($tracks); | ||
- | |||
- | $track_draw = new ImagickDraw(); | ||
- | $track_draw-> | ||
- | $track_draw-> | ||
- | $track_draw-> | ||
- | $track_draw-> | ||
- | $track_draw-> | ||
- | |||
- | $artist_draw = new ImagickDraw(); | ||
- | $artist_draw-> | ||
- | $artist_draw-> | ||
- | $artist_draw-> | ||
- | $artist_draw-> | ||
- | $artist_draw-> | ||
- | |||
- | $flip_flop = 0; | ||
- | $letter_order = [' | ||
- | $letter = 0; | ||
- | $number = 1; | ||
- | |||
- | $config = []; | ||
- | |||
- | for ($i = 0; $i < count($tracks); | ||
- | // The track | ||
- | $track = $tracks[$i]; | ||
- | $track[' | ||
- | |||
- | $config[" | ||
- | |||
- | // Load base | ||
- | if (!$flip_flop) { | ||
- | $img = new Imagick(' | ||
- | } | ||
- | else { | ||
- | $img = new Imagick(' | ||
- | } | ||
- | |||
- | // Calc position of track | ||
- | $metrics = $img-> | ||
- | $text_x = floor(336 - ($metrics[' | ||
- | $text_y = 52; | ||
- | |||
- | // Add track | ||
- | $img-> | ||
- | |||
- | // Calc position of artist | ||
- | $metrics = $img-> | ||
- | $text_x = floor(336 - ($metrics[' | ||
- | $text_y = 101; | ||
- | |||
- | // Add artist | ||
- | $img-> | ||
- | |||
- | // The second track | ||
- | if (isset($tracks[$i + 1])) { | ||
- | $track = $tracks[$i + 1]; | ||
- | $track[' | ||
- | |||
- | // Calc position of track | ||
- | $metrics = $img-> | ||
- | $text_x = floor(336 - ($metrics[' | ||
- | $text_y = 188; | ||
- | |||
- | // Add track | ||
- | $img-> | ||
- | |||
- | // Calc position of artist | ||
- | $metrics = $img-> | ||
- | $text_x = floor(336 - ($metrics[' | ||
- | $text_y = 133; | ||
- | |||
- | // Add artist | ||
- | $img-> | ||
- | } | ||
- | |||
- | $filename = $letter_order[$letter].$number.' | ||
- | $img-> | ||
- | |||
- | $num = $number+1; | ||
- | |||
- | if ($num == 10) { | ||
- | $num = 0; | ||
- | } | ||
- | |||
- | $config[" | ||
- | |||
- | if ($number == 9) { | ||
- | $number = 1; | ||
- | $letter++; | ||
- | } | ||
- | else { | ||
- | $number += 2; | ||
- | } | ||
- | |||
- | $flip_flop = !$flip_flop; | ||
- | } | ||
I may have stumbled across a loophole in the Staples pricing system as they printed these on cards and individually cut them all out for not a lot of money. | I may have stumbled across a loophole in the Staples pricing system as they printed these on cards and individually cut them all out for not a lot of money. |
info/wallbox_conversion_blog.1431087815.txt.gz · Last modified: 2015/05/08 08:23 by 174.97.189.204