Aaron Schulz has submitted this change and it was merged.
Change subject: Make score work with multi-page files
......................................................................
Make score work with multi-page files
Score was looking for files of the form "foo-1.png", "foo-2.png"
where really it should have been looking for "foo-page1.png".
(Someone should double check that it isn't just my install of
lilypond being broken or something).
Also there was a variable name mismatch in the multipage handling
code.
I'm not sure if it really is appropriate to have "Page 1" in the
alt text. I can't imagine what a blind person would do with that
info, however I left it there. I also added the page number to
title, as its mildly useful as a tooltip.
As an aside, I'm not sure if it would make sense to add a sanity
check somewhere - only copy over a max 5000 pages or something.
Change-Id: I09f1fca86a38655dfc1583835c3e59823a08653c
---
M Score.body.php
1 file changed, 14 insertions(+), 12 deletions(-)
Approvals:
Aaron Schulz: Verified; Looks good to me, approved
diff --git a/Score.body.php b/Score.body.php
index 2c1c1bf..11cc593 100644
--- a/Score.body.php
+++ b/Score.body.php
@@ -408,7 +408,7 @@
/* Generate PNG and MIDI files if necessary */
$imageFileName = "{$options['file_name_prefix']}.png";
- $multi1FileName =
"{$options['file_name_prefix']}-1.png";
+ $multi1FileName =
"{$options['file_name_prefix']}-page1.png";
$midiFileName = "{$options['file_name_prefix']}.midi";
$metaDataFileName =
"{$options['file_name_prefix']}.json";
@@ -475,19 +475,21 @@
} elseif ( isset( $existingFiles[$multi1FileName] ) ) {
$link = '';
for ( $i = 1; ; ++$i ) {
- $fileName =
"{$options['file_name_prefix']}-$i.png";
+ $fileName =
"{$options['file_name_prefix']}-page$i.png";
if ( !isset( $existingFiles[$fileName]
) ) {
break;
}
- list( $width, $height ) =
$metaData[$imageFileName]['size'];
+ $pageNumb = wfMessage( 'score-page' )
+ ->inContentLanguage()
+ ->numParams( $i )
+ ->plain();
+ list( $width, $height ) =
$metaData[$fileName]['size'];
$link .= Html::rawElement( 'img', array(
'src' =>
"{$options['dest_url']}/$fileName",
'width' => $width,
'height' => $height,
- 'alt' => wfMessage(
'score-page' )
- ->inContentLanguage()
- ->numParams( $i )
- ->plain()
+ 'alt' => $pageNumb,
+ 'title' => $pageNumb
) );
}
} else {
@@ -624,11 +626,11 @@
self::trimImage( $factoryImage,
$factoryImageTrimmed );
} else {
for ( $i = 1; ; ++$i ) {
- $src = "$factoryDirectory/file-$i.png";
+ $src =
"$factoryDirectory/file-page$i.png";
if ( !file_exists( $src ) ) {
break;
}
- $dest =
"$factoryDirectory/file-$i-trimmed.png";
+ $dest =
"$factoryDirectory/file-page$i-trimmed.png";
self::trimImage( $src, $dest );
}
}
@@ -675,14 +677,14 @@
} else {
for ( $i = 1; ; ++$i ) {
if ( $wgScoreTrim ) {
- $src =
"$factoryDirectory/file-$i-trimmed.png";
+ $src =
"$factoryDirectory/file-page$i-trimmed.png";
} else {
- $src = "$factoryDirectory/file-$i.png";
+ $src =
"$factoryDirectory/file-page$i.png";
}
if ( !file_exists( $src ) ) {
break;
}
- $dstFileName =
"{$options['file_name_prefix']}-$i.png";
+ $dstFileName =
"{$options['file_name_prefix']}-page$i.png";
$dest =
"{$options['dest_storage_path']}/$dstFileName";
$ops[] = array(
'op' => 'store',
--
To view, visit https://gerrit.wikimedia.org/r/63266
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I09f1fca86a38655dfc1583835c3e59823a08653c
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Score
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: J <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits