⚡ 追加: 複数のキャラクター画像を利用できる機能#385
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c3762fc7f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @{[ input 'image','hidden' ]} | ||
| <input type="checkbox" name="imageDelete" value="1"> 画像1を削除する | ||
| @{[ join '', map { my $n=$_; my $suffix = $n == 1 ? '' : $n; input("image$suffix",'hidden') . input("imageUpdate$suffix",'hidden') } (1 .. ($set::image_maxcount || 1)) ]} | ||
| <br>メイン画像:@{[ join ' ', map { my $n=$_; qq|<label><input type="radio" name="mainImage" value="$n" |.($::pc{mainImage}==$n?'checked':'').qq|> $n</label>| } (1 .. ($set::image_maxcount || 1)) ]} |
There was a problem hiding this comment.
ここで画像2以降をメインに選べるようになりましたが、mode=json は _core/lib/json.pl:47-48 のまま image / imageUpdate(画像1)だけを見て imageURL を作っています。そのため画像1が空で画像2をメインにしたシートは外部連携やエクスポートで画像なしになり、画像1もある場合はユーザーが選んだメイン画像ではなく画像1のURLを返してしまいます。JSON側も mainImage に対応する imageN / imageUpdateN を参照する必要があります。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58eded1345
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if(saving){ return; } | ||
| if(!formCheck()){ return false; } | ||
|
|
||
| saveCurrentImageLayout(); |
There was a problem hiding this comment.
この呼び出しは全編集画面で実行されますが、renderEditPageStart を使う SW2 の魔物/アイテムや既存の国・クラン・一般アイテム編集フォームは renderImageForm を通らないため editingImageFit などを持ちません。その状態で保存すると saveCurrentImageLayout() 内の form.editingImageFit.value 参照で TypeError になり、fetch まで進まず保存できません。画像レイアウト欄が存在する場合だけ呼ぶ必要があります。
Useful? React with 👍 / 👎.
| else { $pc{imageCopyright} = unescapeTags($pc{imageCopyright}) } | ||
| $pc{imageLayouts} = %layouts ? JSON::PP->new->canonical(1)->encode(\%layouts) : "{}"; | ||
|
|
||
| $pc{imageSrc} = "./?id=$::in{id}&mode=image&imageNo=$pc{mainImage}&cache=$pc{imageUpdate}"; |
There was a problem hiding this comment.
| if($pc{convertSource} && $pc{image}){ | ||
| $pc{imageSrc} = $pc{imageURL}; |
There was a problem hiding this comment.
コンバート画像でも imageLayouts を初期化してください
この分岐に入るコンバート表示(例: blp/convert.pl や dx3/convert.pl は convertSource と imageURL/image を設定)では、下の else で追加された $pc{imageLayouts} 初期化が実行されません。一方 sheet-head.html は常に const imageLayouts = <TMPL_VAR imageLayouts />; を出すため、外部画像付きコンバート結果は const imageLayouts = ; という構文エラーになり、以降のシート用 JS が動かなくなります。この分岐でも少なくとも {} を設定してください。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 26bff2bc2b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function setImagePosition() { | ||
| editingImageNo = Number(form.mainImage?.value || 1); | ||
| loadImageLayout(editingImageNo); | ||
| setPreviewImage(editingImageNo); |
There was a problem hiding this comment.
画像設定で位置やセリフを変更したあとに「メイン画像」ラジオを押すケースでは、この関数が現在の編集内容を hidden の imageFitN / wordsN へ退避しないまま loadImageLayout() でフォームを上書きします。その後の保存時は新しい editingImageNo だけが saveCurrentImageLayout() されるため、直前に編集していた画像のレイアウト変更が失われます。サムネイル切替の switchImageLayoutConfig() と同様、ユーザー操作で切り替える前に現在のレイアウトを保存する必要があります。
Useful? React with 👍 / 👎.
| form[`imagePositionY${suffix}`].value = form.editingImagePositionY.value; | ||
| form[`imageCopyright${suffix}`].value = form.editingImageCopyright.value; | ||
| form[`imageCopyrightURL${suffix}`].value = form.editingImageCopyrightURL.value; | ||
| form[`words${suffix}`].value = form.editingWords.value; |
| $pc{imageSrc} = "./?id=$::in{id}&mode=image&imageNo=$pc{mainImage}&cache=$pc{imageUpdate}"; | ||
| $pc{imageURL} = url()."?id=$::in{id}&mode=image&imageNo=$pc{mainImage}&cache=$pc{imageUpdate}"; | ||
| $pc{imageOgpURL} = url()."?id=$::in{id}&mode=ogp-image&imageNo=$pc{mainImage}&cache=$pc{imageUpdate}"; |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f0357b1bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| obj.files = e.dataTransfer.files; | ||
| imagePreView(obj.files[0], $set::image_maxsize || 0); | ||
| imagePreView(obj.files[0], imageMaxSize, imageNo); |
| } | ||
| } | ||
| function getImageId(direction = 0) { | ||
| const ids = Object.keys(images).map(Number).sort((a, b) => a - b); |
There was a problem hiding this comment.
| my $mainSuffix = $pc{mainImage} == 1 ? '' : $pc{mainImage}; | ||
| if($OPT{includeImage} && $pc{image}){ | ||
| $pc{imageURL} = ($OPT{imageUrlBase} || $self)."?id=$id&mode=image&cache=$pc{imageUpdate}"; | ||
| $pc{imageURL} = ($OPT{imageUrlBase} || $self).qq|?id=$id&mode=image&imageNo=$mainSuffix&cache=$pc{"imageUpdate$mainSuffix"}|; |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c57589cbe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| my $imageNo = $::in{imageNo} || $pc{mainImage} || 1; | ||
| $imageNo = 1 if $imageNo !~ /^\d+$/ || $imageNo < 1 || $imageNo > ($set::image_maxcount || 1); | ||
| my $suffix = $imageNo == 1 ? '' : $imageNo; | ||
| my $ext = $pc{"image$suffix"}; |
There was a problem hiding this comment.
メイン画像が2/3のシートで mode=ogp-image&imageNo=2 が呼ばれると、ここで画像ファイルだけは image2/image3 に切り替わりますが、直後の outputOgpImage(%pc) は無印の imageFit / imagePositionX / imagePercent だけを参照します。そのため画像2/3に個別のトリミングを設定しても、SNSカードでは画像1の設定またはデフォルトで切り抜かれます。imageNo に対応するレイアウト値を無印キーへ反映してからOGPを生成してください。
Useful? React with 👍 / 👎.
| if($OPT{includeImage} && $pc{"image$mainSuffix"}){ | ||
| $pc{imageURL} = ($OPT{imageUrlBase} || $self).qq|?id=$id&mode=image&imageNo=$mainSuffix&cache=$pc{"imageUpdate$mainSuffix"}|; | ||
| my $imgName = qq|image$mainSuffix.$pc{"image$mainSuffix"}|; |
There was a problem hiding this comment.
BLP/KIZ の loadPartnerData(... includeImage => 1) ではこの分岐でURLと実体だけを mainImage の番号へ切り替えていますが、呼び出し側のテンプレートは p1_imageFit / p1_imagePositionX / p1_imageCopyright など無印キーを表示に使います。相手が画像2/3をメインにして個別の配置や権利表記を設定している場合、画像だけ画像2/3でレイアウトや注釈は画像1のものになってしまうため、imageFit$mainSuffix なども無印キーへコピーする必要があります。
Useful? React with 👍 / 👎.
| $pc{imageData} = readSheetFileBinary($dataDir, $file, $imgName); | ||
| } | ||
| } | ||
| elsif(!$OPT{includeImage} && $pc{image}){ |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d32cc95629
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| compressedImageFile = null; | ||
| compressScale = 1; | ||
| switchImageLayoutConfig(imageNo); |
There was a problem hiding this comment.
この共通関数は、GC国・MSクラン・SW2神格など旧来の単一画像フォーム(例: _core/lib/gc/edit-country.pl:449, _core/lib/ms/edit-clan.pl:139, _core/lib/sw2/edit-arts.pl:183)からも imagePreView(this.files[0], ...) で呼ばれますが、それらのフォームには editingImageFit や imageFit 系 hidden がありません。ファイル選択時にここから switchImageLayoutConfig() → saveCurrentImageLayout() が走ると form.imageFit が undefined で TypeError になり、プレビューもアップロード設定もできません。複数画像フォームでない場合は従来の単一画像プレビュー経路に分岐してください。
Useful? React with 👍 / 👎.
| > :is(.image, .image-none) { | ||
| position: absolute; | ||
| z-index: 2; | ||
| inset: 0; |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 958103b095
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| compressedImageFile = null; | ||
| compressScale = 1; | ||
| if(form.editingImageFit){ switchImageLayoutConfig(); } |
There was a problem hiding this comment.
| document.addEventListener('DOMContentLoaded', () => { | ||
| if(document.getElementById('image')){ | ||
| document.getElementById('image').style.backgroundImage = `url(${images['1']})`; | ||
| document.getElementById('image').style.backgroundImage = `url(${images['<TMPL_VAR mainImage DEFAULT=1>']})`; |
There was a problem hiding this comment.
mode=download では images[...] に埋め込んだ base64 をここで反映していますが、今回テンプレート側の表示対象は #image ではなくその子の .image.current になり、背景サイズや位置も子要素に付いています。ダウンロードHTMLを開くと子要素には依然 ./?id=...&mode=image のURLが残るため自己完結せず、親に設定したbase64もトリミング設定を持たないまま背面に出るだけになります。base64は .image.current 側へ設定する必要があります。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 32de8ca3b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if($oldext{$imageNo} && $oldext{$imageNo} ne $pc{$imageKey}){ | ||
| deleteSheetFile("${dataDir}${userDir}", $file, "image$suffix.$oldext{$imageNo}"); # 前のファイルを削除 | ||
| } | ||
| updateSheetFile("${dataDir}${userDir}", $file, "image$suffix.$pc{$imageKey}", $imageData{$imageNo}); |
| if(document.getElementById('image')){ | ||
| document.getElementById('image').style.backgroundImage = `url(${images['1']})`; | ||
| if(document.querySelectorAll('#image .image.current')){ | ||
| document.querySelectorAll('#image .image.current').style.backgroundImage = `url(${images['<TMPL_VAR mainImage DEFAULT=1>']})`; |
There was a problem hiding this comment.
querySelectorAll() は常に NodeList を返し、NodeList には style がないため、ダウンロードHTMLを開くとこの行で TypeError になります。その結果、modeDownload 用に用意した images[...] の base64 が .image.current へ反映されず、HTML単体保存したシートが元の ./?id=...&mode=image URLを参照したままになります。querySelector() を使うか、NodeList をループして更新してください。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ee98d2fb0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $pc{imageURL} = url()."?id=$::in{id}&mode=image&cache=$pc{imageUpdate}"; | ||
| $pc{imageOgpURL} = url()."?id=$::in{id}&mode=ogp-image&cache=$pc{imageUpdate}"; | ||
| $pc{mainImage} ||= 1; | ||
| if($pc{ver}) { |
There was a problem hiding this comment.
ver=0 のコンバート画像も images に入れてください
BLP/DX3 のキャラクターシート倉庫変換などは convert.pl で imageURL/image を設定しつつ ver は 0 のままなので、この条件を通らず下の convertSource 分岐で imageSrc だけが設定されます。今回テンプレート側のクリック処理は popImage(<TMPL_VAR mainImage>) から images[id] を参照するため、画面上の画像は表示されても拡大表示では undefined を開いてしまいます。ver == 0 の外部コンバート画像でも images(必要なら imageLayouts)を初期化してください。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bcef9ff3d3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| > :is(.prev-button, .next-button) { | ||
| display: none; | ||
| #image:hover & { display: block; } |
There was a problem hiding this comment.
There was a problem hiding this comment.
入れ子セレクタ & の解釈が間違っています。
この場合、#image:hover #image > ... ではなく、 :is(#image:hover ...):is(#image > ...) と相当となるため、 #image に対するhover時に想定通りdisplay:block が有効となります。
よって、修正は不要です。
参考
https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Nesting/Using#appended_nesting_selector
|
@codex 再レビューをお願いします。 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bcef9ff3d3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| // 現在フォームに入っているレイアウト設定をプレビューへ反映 | ||
| imagePosition(); |
There was a problem hiding this comment.
ms/edit-clan.pl、gc/edit-country.pl、sw2/edit-arts.pl の画像欄はまだ editingImageFit などを持たない旧形式のまま imagePreView() を呼ぶため、ここで常に imagePosition() に入ると form.editingImageFit 参照で例外になります。特に上限超過画像ではファイル入力を空にした後、compressedImageFiles へ代替ファイルを入れる前に例外で止まるため、圧縮後画像が送信されずアップロードできません。
Useful? React with 👍 / 👎.
| foreach my $n (1 .. ($set::image_maxcount || 1)){ | ||
| my $suffix = $n == 1 ? '' : $n; | ||
| $pc{"imageURL$suffix"} = url().qq|?id=$id&mode=image&imageNo=$n&cache=$pc{"imageUpdate$suffix"}| if $pc{"image$suffix"}; |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba4f9c827d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $pc{"imageURL$suffix"} = url().qq|?id=$id&mode=image&imageNo=$n&cache=$pc{"imageUpdate$suffix"}| if $pc{"image$suffix"}; | ||
| } | ||
| if(!$pc{image} && $pc{mainImage} > 1){ | ||
| $pc{image} = $pc{"image$pc{mainImage}"} |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: efa969665a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| my $mainSuffix = $::pc{mainImage} == 1 ? '' : $::pc{mainImage}; | ||
| my %imageURLs; | ||
| my $imageURLsJS; | ||
| foreach my $n (1 .. $set::image_maxcount){ |
There was a problem hiding this comment.
image_maxcount 未設定時も URL を初期化してください
既存環境の設定ファイルに新設の image_maxcount がまだ無い、または 0 の場合、このループだけが他の箇所と違って || 1 のフォールバックを使わないため %imageURLs / savedImageURLs が空になります。一方で直下の hidden/radio/サムネイル生成は ($set::image_maxcount || 1) で 1 枚分を描画し、各 edit-chara.js のロード時 setImagePosition() が setPreviewImage(1) を呼ぶので、保存済み画像の背景が空文字で上書きされ、編集画面で既存画像を確認・調整できなくなります。ここも他と同じフォールバックを使ってください。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 560143ad97
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| // 画像配置 ---------------------------------------- | ||
| let imgURL = ''; |
There was a problem hiding this comment.
キャラクター編集画面では renderImageForm 側のインラインスクリプトも let imgURL = ... を出力しているため、この共通スクリプトで同じトップレベル let を宣言するとブラウザが Identifier 'imgURL' has already been declared の構文エラーにします。edit.js は defer で後から評価されるので、画像フォームを持つ通常のキャラクター編集画面で formSubmit など共通処理全体が定義されず、保存ボタンや画像プレビューが動かなくなります。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90da2951d3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (my $deletedImages = deleteSheetImages($sheetBaseDir, $file)) { | ||
| $message .= "画像を${deletedImages}件削除しました。<br>"; | ||
| } |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a198495800
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $pc{mainImage} = 1 if !$pc{mainImage} || $pc{mainImage} !~ /^[0-9]+$/ || $pc{mainImage} > $imageMaxCount; | ||
| if(!$pc{'image'.($pc{mainImage} == 1 ? '' : $pc{mainImage})}){ |
There was a problem hiding this comment.
画像1が空で画像2/3だけを登録して保存する場合、この補正で mainImage は番号付き画像へ切り替わりますが、一覧ファイル用の $::newline はその前の %pc = data_calc(\%pc) で各 calc 側の $pc{image} だけを見て作られたままです。そのため閲覧画面では画像が出るシートでも listfile の画像列が空になり、各一覧の「画像あり」フィルタから除外されます。補正後に一覧行を再生成するか、calc 側で番号付き画像を画像ありとして扱う必要があります。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00f2a699e7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| join '', map { | ||
| my $n = $_; | ||
| my $suffix = ($n == 1) ? '' : $n; | ||
| input("image$suffix",'hidden') |
There was a problem hiding this comment.
ここでは既存画像の拡張子だけを送信していますが、save.pl はリクエストの %pc をそのまま保存し、imageUpdateN は新規アップロードを受理した時だけ再設定します。そのため画像を変更せずに通常保存しただけで既存の imageUpdate / imageUpdate2 / imageUpdate3 が data.cgi から消え、以後の閲覧・JSON・OGP・編集プレビューのキャッシュキーが空になって画像更新時刻を維持できません。各画像の imageUpdate$suffix も hidden で送るか、保存側で旧値を引き継いでください。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b98a3e8ad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| binmode $BEHEADED; | ||
| my $image = do { local $/; <$BEHEADED> }; | ||
| close($BEHEADED); | ||
| updateSheetFile($sheetBaseDir, $file, "image.$ext", $image); |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: effe16b5b0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $pc{imagePositionY} = $pc{"imagePositionY$mainSuffix"}; | ||
| $pc{imageCopyright} = $pc{"imageCopyright$mainSuffix"}; | ||
|
|
||
| my $imgName = qq|image$mainSuffix.$pc{"image$mainSuffix"}|; |
There was a problem hiding this comment.
この版では $imgName でメイン画像2/3の実体を読むようになっていますが、$pc{image} 自体は無印(画像1)の拡張子のままです。BLP/KIZ のパートナー自動取得で相手のメイン画像が2/3かつ画像1と拡張子が違う、または画像1が空の場合、partnerImageToBase64() は pN_imageData に入ったメイン画像のバイナリを古い/空の pN_image MIME として data URI 化するため、ダウンロードHTML上のパートナー画像が壊れる可能性があります。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 309d70999a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $pc->{"p${num}_imagePercent"} = $pc->{"p${num}_imagePercent$suffix"}; | ||
| $pc->{"p${num}_imagePositionX"} = $pc->{"p${num}_imagePositionX$suffix"}; | ||
| $pc->{"p${num}_imagePositionY"} = $pc->{"p${num}_imagePositionY$suffix"}; | ||
| $pc->{"p${num}_imageCopyright"} = $pc->{"p${num}_imageCopyright$suffix"}; |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fcdaa6bb9e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if(saving){ return; } | ||
| if(!formCheck()){ return false; } | ||
|
|
||
| if(imageType === 'character'){ saveCurrentImageLayout(); } |
There was a problem hiding this comment.
imageType 未定義の編集画面を保存できるようにしてください
SW2 の魔物・アイテム編集画面は renderEditPageStart でこの共通 edit.js を読み込みますが、画像フォームを出さないため const imageType を定義しません(_core/lib/sw2/edit-mons.pl / edit-item.pl を確認)。その状態で保存ボタンや Ctrl+S を押すとここで ReferenceError: imageType is not defined が発生し、FormData 送信に進めないため、これらのシートが保存不能になります。typeof imageType !== 'undefined' でガードするなど、画像欄のない編集画面を許容してください。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9165ec7eb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| my $suffix = imageSuffix($n); | ||
| $pc{"imageURL$suffix"} = url().qq|?id=$id&mode=image&imageNo=$n&cache=$pc{"imageUpdate$suffix"}| if $pc{"image$suffix"}; | ||
| } | ||
| if(!$pc{image} && $pc{mainImage} > 1){ |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eed39ae139
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| if($pc{mainImage} > 1){ # 複数画像未対応verへの対応 | ||
| my $suffix = imageSuffix($pc{mainImage}); | ||
| foreach my $key (qw/image imageURL imageFit imagePercent imagePositionX imagePositionY imageCopyright imageCopyrightURL words wordsX wordsY/){ |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a04c8303b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| editingImageNo = Number(form.mainImage?.value || 1); | ||
| loadImageLayout(editingImageNo); |
There was a problem hiding this comment.
画像設定画面で画像1のトリミングやセリフを調整したあと、上部の「メイン画像」ラジオで画像2/3を選ぶと、この関数が editingImageNo を先に上書きして loadImageLayout() するため、直前に編集していた画像の値が hidden の imageFit / words などへ退避されず破棄されます。サムネイル切替側は switchImageLayoutConfig() で保存しているので、ラジオ切替でも同様に現在のレイアウトを保存してから読み替えないと、そのまま保存したとき直前の画像設定だけ失われます。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 688914b8b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| foreach my $key (qw/image imageUpdate imageURL imageFit imagePercent imagePositionX imagePositionY imageCopyright imageCopyrightURL words wordsX wordsY/){ | ||
| ($pc{$key}, $pc{"$key$suffix"}) = ($pc{"$key$suffix"}, $pc{$key}); | ||
| } | ||
| $pc{mainImage} = 1; |
There was a problem hiding this comment.
mode=json で画像2/3をメインにしているシートを出力すると、この互換処理で image 系キーを入れ替えたうえで mainImage を常に 1 にしてしまうため、複数画像対応の利用者やJSON再取り込み側は元のメイン画像番号を復元できません。特に画像1と画像2の両方がある場合、imageURL2 も実際には画像1を指す状態になり、JSON上の番号と mode=image&imageNo=N の実体がずれます。従来キーへメイン画像をコピーする場合でも、mainImage は実際の選択番号のまま残してください。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1bcee39cec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| imagePosition(); | ||
|
|
||
| // 著作権表示・セリフ表示も更新 | ||
| wordsPreView(); |
There was a problem hiding this comment.
セリフプレビュー更新をキャラクター画像だけに限定してください
GC国・MSクラン・SW2神格の単一画像フォームは imageType = 'symbol' で、editingWords や words-preview を持たないことを確認しました。この行は setPreviewImage() から常に呼ばれるため、画像選択時に form.editingWords.value で TypeError になります。特に上限超過画像では直前に imageFile を空にしてから、圧縮結果を compressedImageFiles に入れる前に止まるので、圧縮後画像を保存できません。imageType === 'character' の場合だけ呼ぶようにしてください。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f040a4557
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| foreach my $key (qw/image imageUpdate imageURL imageFit imagePercent imagePositionX imagePositionY imageCopyright imageCopyrightURL words wordsX wordsY/){ | ||
| ($pc{$key}, $pc{"$key$suffix"}) = ($pc{"$key$suffix"}, $pc{$key}); |
There was a problem hiding this comment.
画像1が空で画像2/3をメインにしているシートでは、この互換処理が image2 / imageURL2 などを従来キーへコピーせず swap しているため、出力後の JSON では mainImage が 2 のままなのに image2 側が空になります。以前の mainImage 書き換えは消えていますが、今回の版でもこの代入が swap のまま残っているのが新しい根拠で、複数画像対応の JSON 利用者や別ゆとシート経由のパートナー取り込みが mainImage の番号をたどると画像を見失います。
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4589291c7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function getImageId(direction = 0) { | ||
| const ids = | ||
| Object.keys(images) | ||
| .filter(key => /[0-9]/.test(key)) |
There was a problem hiding this comment.
BLP/KIZ のようにパートナー画像があるシートでは、images に p1/p2 も追加されますが、この条件だとそれらも通過して Number('p1') が NaN になります。画像2枚以上のキャラクターでパートナーも表示している場合、最後の画像から「次」または先頭から「前」を押すと選択先が NaN になって images.hasOwnProperty(selected) が失敗し、端でカルーセルが回らなくなります。imageLayouts のキー、または /^\d+$/ のような純粋な番号だけを対象にしてください。
Useful? React with 👍 / 👎.
Motivation
Description
image_maxcountwith a default of1inconfig-default.plto control maximum stored images per sheet._core/lib/edit.js) to support multiple image inputs, per-image compression and previews by trackingcompressedImageFilesand passingimageNothrough image handlers, backup, form submission and JSON export.image2.jpg) and to acceptimageNoparameters when redirecting or serving images in_core/lib/others.pl,_core/lib/subroutine.pl, and_core/lib/view.pl._core/lib/save.plto handle multiple incomingimageFileNfields, per-image deletion flags, per-image update timestamps, to maintainmainImageselection, and to pass image data intodataSave.deleteImageDatahelper in_core/lib/edit.plto simplify removal of image-related keys and updaterenderImageFormto render multiple file inputs and a radio UI formainImage.dataSaveto archive/read image files with numeric suffixes, include uploaded image data in archives, and to delete/replace the correct suffixed files on updates.Testing
perl -c(syntax checks) on modified Perl modules and they completed successfully._core/lib/edit.jswithnode --checkand it reported no syntax errors.Codex Task