#DockerApp
Explore tagged Tumblr posts
Photo
看看網頁版全文 ⇨ 依據圖片有沒有透明的狀態決定剪裁方式 / Trimming Image based on Alpha Channel https://blog.pulipuli.info/2023/04/blog-post_470.html 之前在「剪裁圖片的白色邊緣,但保留物件的白色」那篇有提到,如果圖片本身就有透明的部分,原本的做法會讓圖片內的透明變成白色。 要怎麼改它好呢?。 ---- # 裁切多餘的透明 / Trim transparent parts of an image。 先來張圖。 這張圖的周圍跟頭髮內部都有透明的部分了,讓我們拉大來看看。 可以看到袖子下方是透明的。 但是它的周圍有多餘的透明區域。 要怎麼把它裁掉呢?。 ## 原本的做法 / Previous command。 如果是用「白色背景變透明,但是保留物件的白色」這篇的做法,那用以下指令裁切的結果,會讓中間的透明區域變成白色:。 [Code...] 周圍多餘的透明區域是裁掉了沒錯。 但是中間的透明區域變成白色了。 ## 正確的指令 / Correct command。 在這個例子中,我們只需要將圖片周圍的透明裁掉即可。 用ImageMagick的「-trim」可以輕鬆做到這件事情:。 [Code...] 裁切結果如上圖所示,可以看到透明的區域只剩下物件本身了。 當然,袖子下面的透明區域依然是保留的。 因此結合上述的用法,我們���要在圖片沒有透明區域的情況下、或是圖片有透明區域的情況下,各別採用不同的做法。 # 判斷圖片有沒有透明的區域 / Detect alpha channel of an image。 https://stackoverflow.com/a/2581516。 ImageMagick提供了可以偵測圖片通道的工具,叫做「identify」。 感謝msw的說明,用identify偵測通道的做法如下:。 [Code...] 用這張圖片做分析,結果會是「srgba」。 其中的a表示透明通道。 用這張圖片做分析,結果會是「srgb」。 沒有a,表示這張圖片沒有透明的部分。 因此我們就可以用有沒有「a」來判斷要用那個指令了。 # Docker App https://github.com/pulipulichen/docker-app-Image-Trim。 這段整合我已經寫在docker-app-Image-Trim裡面了,直接用即可。 ---- 文章最後的問題是:你通常需要裁剪那些圖片呢?。 在留言舉個例子吧! ---- 看看網頁版全文 ⇨ 依據圖片有沒有透明的狀態決定剪裁方式 / Trimming Image based on Alpha Channel https://blog.pulipuli.info/2023/04/blog-post_470.html
0 notes
Text
Phpstorm docker xdebug

#PHPSTORM DOCKER XDEBUG HOW TO#
#PHPSTORM DOCKER XDEBUG CODE#
#PHPSTORM DOCKER XDEBUG FREE#
We can run this command: docker-compose run -rm php7.3 php -v which will It is important as we will add special Xdebug settings to the php.ini file. We can tweak our PHP settings whatever we like for our development environment. Docker file installs Xdebug extension with pecl command.# This needs in order to run xdebug from PhpStormĮNV PHP_IDE_CONFIG 'serverName=DockerApp' RUN docker-php-ext-install mbstring bcmath The Dockerfile looks like this: FROM php:7.3 The fileĬontains all the configuration you need for your PHP service - dependencies, libraries, packages, etc. This file describes the php service which is based on a Dockerfile located at docker/php/Dockerfile. :/var/www # map the current folder to the container"s filesystem (so PHP scripts are injected to the container) Init: true # allows sending signals to the PHP process, very helpful to stop process in the middle with Ctrl+C or Cmd+C With the docker-compose.yml that I put in the root of my PHP project: version: "3.7"Ĭontainer_name: myapp # pick a name for the containerĬontext: docker/php # here is the Docker file for this container I am using docker-compose to manage my containers. Debugging PHP scripts # Configure docker container.Docker container with PHP+XDebug installed.
#PHPSTORM DOCKER XDEBUG HOW TO#
And Xdebug is one of the most known tools for PHP debugging.īut how to use it inside of the docker container? Down below I will describe my normal daily setup: Daily work with PHP includes debugging, yeah. However, I wish MacOS performance was better for docker engine. In PHP development flow, Docker is my everyday tool. You can have any version of any service in the container which won't affect each other. Docker also helps you keep your system dependencies under control. It is much easier to spin up a docker container rather than starting a new virtual machine (ie Vagrant). Nowadays we move from using the local environment or virtual machines to Docker-based development.
#PHPSTORM DOCKER XDEBUG FREE#
Protect your site from ddos with free built-in nginx feature ngx_http_limit_req_module.Save all dates in UTC for multi timezone apps.Don't trust files users upload to your server.
#PHPSTORM DOCKER XDEBUG CODE#
My PHP code structure should tell you what it does - or how do I show project's intents to my teammates?.
Why I need a bigger monitor (monitors set) to improve quality of my code?.
One step towards clean architecture from rapid application development.
Clean exceptions with logging and translation.
Clean architecture implemented as a PHP app.
When clean architecture is not worth it.
Authorization and authentication in clean architecture.
Error handling in PHP and formatting pretty error responses to users.
How to validate(check) a php array format (structure).
How to log(see, view) every HTTP request and response in Laravel.
Request handler as a gateway to your backend – keep your code clean.
Clean Laravel app with Prooph message bus.
Make your website partly static and reduce response time.
Nginx to cache dynamic PHP(Laravel) pages.
Frameworkless foundation of your PHP application.
A hacker and a nerd - the two hats of engineers.
PHP 7: Zend Certified Engineer Exam (ZCE).
PHP Cache - practical, reliable, multi driver, multilevel chainable cache.
OpenAPI with PHP - documenting and testing API automatically.
Docker + PHP + Xdebug + PHPStorm = Good Developer Experience.
Expensive Code (Maintainable PHP Backend 1/3).
Evaluation Of Expressions In PHP (as of 7.4).

0 notes
Photo
如果要把圖片的白色背景變成透明,但是要保留物件上的白色,以前都要打開影像編輯軟體,用魔術棒選色移除,但有沒有更快的做法呢?。 ---- # ImageMagick https://imagemagick.org/index.php。 是的,說到用指令處理圖片,又是我們的老朋友ImageMagick啦。 之前講過ImageMagick可以裁邊、可以移除白色的背景,那它可以在移除掉白色背景的同時,還能保留物件上的白色嗎?。 https://legacy.imagemagick.org/discourse-server/viewtopic.php?t=31341。 eddyparkinson在ImageMagick的論壇上求助到,他想要為白色的衣服去除背景,但又不希望白色的衣服也變得透明。 下面snibgo就提供了解決方案:。 [Code...] 這串指令重點在於使用了「-fill none -fuzz 3% -draw "color 0,0 floodfill"」,它會從X軸0和Y軸0的起點開始著色(這裡是設定為透明色none),但當週遭顏色差異超過3%時就會被擋下。 執行結果如上圖。 周圍白色的背景現在已經是透明色了。 不過左右周圍還是有些多餘的空白處,如果要進一步裁切邊緣的話,我們可以再加上「-trim」,指令如下:。 [Code...] 結果如上圖所示,左右的空白處已經消失了。 # Docker APP https://github.com/pulipulichen/docker-app-Image-Trim。 我把此功能加入到docker-app-Image-Trim中,方便未來直接使用。 以下順便說明Docker APP的用法:。 首先要下載執行檔: - Linux: https://pulipulichen.github.io/docker-app-Image-Trim/bin/image-trim.sh - Windows: https://pulipulichen.github.io/docker-app-Image-Trim/bin/image-trim.exe 開啟它的是,它會檢查你的電腦有沒有安裝必要元件,包括git、Node.js、Docker (或是Docker Desktop)。 如果沒有安裝,程式會提示你到指定網站下載並安裝必要套件。 如果都已經正常安裝,則可以正常執行。 ---- #DockerApp #Image #ImageMagick 繼續閱讀 ⇨ 白色背景變透明,但是保留物件的白色 / Remove White Background but Keep the White Color on the Object https://blog.pulipuli.info/2023/02/remove-white-background-but-keep-the-white-color-on-the-object.html
0 notes