Skip to content

Instantly share code, notes, and snippets.

@ericstone57
Created July 23, 2016 18:00
Show Gist options
  • Select an option

  • Save ericstone57/4079c7a9bf6b08dfa184d2e74d60379e to your computer and use it in GitHub Desktop.

Select an option

Save ericstone57/4079c7a9bf6b08dfa184d2e74d60379e to your computer and use it in GitHub Desktop.

Revisions

  1. ericstone57 created this gist Jul 23, 2016.
    25 changes: 25 additions & 0 deletions sequence_img_combine.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    <?php
    $from = 1;
    $to = 360;
    $figure_lenght = 4;
    $pic_one_row = 3;
    $file_prefix = "output_";
    $file_extension = ".jpg";
    $output_folder = "./result/";
    $output_index = 1;

    while ($from < $to) {
    $str_pics = '';
    for ($i = 0; $i < $pic_one_row; $i++) {
    $filename = $file_prefix.str_pad($from+$i, $figure_lenght, 0, STR_PAD_LEFT).$file_extension;
    if (file_exists("./".$filename)) {
    $str_pics .= $filename." ";
    }
    }
    exec("convert $str_pics +append $output_folder/result_" . str_pad($output_index, $figure_lenght, 0, STR_PAD_LEFT) . ".jpg");

    print $output_index ."\n";

    $output_index++;
    $from += $pic_one_row;
    }