2021年01月01日

PHPフレームワークSlim

PHPフレームワークSlim

【実施環境】
・Windows10 Pro
・IIS 10
【使用ソフト(インストール済み)】
・Composer version 1.10.16 (こちら)
・PHP 7.4.5

インストール
コマンドプロンプトでslimを置きたい場所に移動し、以下のコマンドを実行。
ここではslimをインストールするフォルダ名を「myslim」とする。
composer create-project slim/slim-skeleton:dev-master myslim
IISの設定
既存のWEBサイトまたは新規にWEBサイトを作成し、右クリック>「アプリケーションの追加」を選択する。
以下の項目を入力しOKを押す。
エイリアス(任意の名前)myslim
物理バス{composerを実行した場所}\myslim\public

routes.php変更
\myslim\app にある routes.php の18行目を編集し、IISで設定した「エイリアス」を指定する。
$app->get('/myslim/', function (Request $request, Response $response) {
ブラウザからアクセス
Hello world!が表示されれば成功。
http://localhost/myslim/
タグ:PHP slim IIS
posted by Hiro at 20:20| Comment(0) | プログラム

2020年12月30日

GIMP 2.10 Script-Fu 画像切り抜きスクリプト

自分の作業用スクリプト。
画像から部分的に2か所切り抜いて、それぞれ別ファイルに保存するためのもの。
テキストファイルはUTF-8で保存する。

ファイル配置場所
C:\Users\{ユーザー名}\AppData\Roaming\GIMP\2.10\scripts

プロシージャ一覧
GIMPメニューバー>ヘルプ>プロシージャーブラウザー

ファイル更新後
GIMPメニューバー>フィルター>Script-Fu>スクリプトを再読み込み
;kirinuki-script.scm

(define (kirinuki-script img drawable)
(gimp-image-crop img 1080 1194 0 195)
(gimp-image-convert-grayscale img)
(gimp-image-convert-rgb img)
(gimp-drawable-invert drawable TRUE)
(gimp-rect-select img 225 311 1145 942 CHANNEL-OP-REPLACE FALSE 0)
(gimp-rect-select img 0 0 225 310 CHANNEL-OP-ADD FALSE 0)
(gimp-edit-clear drawable)
(gimp-selection-none img)
;(define drawable (car (gimp-image-active-drawable 1)))
(gimp-drawable-levels drawable HISTOGRAM-VALUE 0.6 0.8 FALSE 1 0 1 FALSE)
(gimp-displays-flush)

;ファイル名取得
(define origin (car (gimp-image-get-filename img)))
(define newname (substring origin 0 (- (string-length origin) 4)))

;保存
;(gimp-selection-all img)
;(kirinuki-save-script img drawable (string-append newname "_Edited.png"))

;切り抜きA保存
(gimp-rect-select img 219 0 861 314 CHANNEL-OP-REPLACE FALSE 0)
(kirinuki-save-script img drawable (string-append newname "_A.png"))
;切り抜きB保存
(gimp-rect-select img 0 306 266 888 CHANNEL-OP-REPLACE FALSE 0)
(kirinuki-save-script img drawable (string-append newname "_B.png"))
)

; PNG画像保存プロシージャ
(define (kirinuki-save-script img drawable output)
(gimp-edit-copy drawable)
(define img_new (car (gimp-edit-paste-as-new-image)))
;(gimp-display-new img_new)
(define drawable_new (car (gimp-image-get-active-drawable img_new)))
(file-png-save2 RUN-NONINTERACTIVE img_new drawable_new output output 0 9 1 0 0 0 0 0 0)
(gimp-selection-none img)
)

(script-fu-register
"kirinuki-script"
"切り抜きスクリプト"
"○○画像用に切り抜きします。"
"Myself"
"copyright 2020 Myself"
"Dec 30, 2020"
""
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
)
(script-fu-menu-register "kirinuki-script" "<Image>/Script-Fu")
参考サイト
タグ:GIMP Script-Fu
posted by Hiro at 15:07| Comment(0) | プログラム

2020年12月20日

Android Studio 環境変数

ファイル名を指定して実行で「sysdm.cpl」を入力。

システムのプロパティ>環境設定タブ>環境変数>ユーザー環境変数

ANDROID_AVD_HOME D:\Android\avd 
ANDROID_SDK_ROOTD:\Android\sdk

※AVDの端末名.iniにパスが描かれているので、移動した場合は書き換える。
avd.ini.encoding=UTF-8
path=D:\Android\avd\Pixel_2_API_30.avd
path.rel=avd\Pixel_2_API_30.avd
target=android-30
タグ:Android Studio
posted by Hiro at 17:20| Comment(0) | プログラム