image icon indicating copy to clipboard operation
image copied to clipboard

Laravel 8: Unable to init from given binary data

Open Minotti opened this issue 3 years ago • 5 comments

I saw it on other issues, but there was no complete solution.

I am using Laravel 8 and PHP 7.4

But, I can't make base64 file when it is jpeg. When PNG works correctly.

My Dockerfile:

RUN apt-get update && apt-get install -y
git
curl
build-essential
libfreetype6-dev
libpng-dev
libjpeg-dev
libonig-dev
libxml2-dev
zip
unzip
&& docker-php-ext-install gd
&& docker-php-ext-configure gd
--with-jpeg = / usr / include /
--with-freetype = / usr / include /

Minotti avatar Feb 28 '21 23:02 Minotti

I solved. "I" hehehe. As I always say and do little: "Look at the documentation".

And the documentation says:

PHP Core Extensions For example, if you want to have a PHP-FPM image with the gd extension, you can inherit the base image that you like, and write your own Dockerfile like this:

FROM php:7.4-fpm RUN apt-get update && apt-get install -y
libfreetype6-dev
libjpeg62-turbo-dev
libpng-dev
&& docker-php-ext-configure gd --with-freetype --with-jpeg
&& docker-php-ext-install -j$(nproc) gd

And guess what? It worked.

I hope I have helped those in need: D

Minotti avatar Feb 28 '21 23:02 Minotti

sorry but my dockerfile show failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 13: unknown instruction: LIBFREETYPE6-DEV can you tell me libfreetype6-dev what is it. and the doc where is it

AlvinQinwen avatar Apr 06 '21 07:04 AlvinQinwen

and this is my dockerfile

FROM php:7.4-fpm

#RUN  docker-php-ext-install redis \
#     && docker-php-ext-install pdo pdo_mysql
#ENV PHPREDIS_VERSION 5.0.0 $PHPREDIS_VERSION

RUN apt-get update && apt-get install -y
    libfreetype6-dev
    libjpeg62-turbo-dev
    libpng-dev
    && docker-php-ext-configure gd --with-freetype --with-jpeg
    && docker-php-ext-install -j$(nproc) gd

RUN  mkdir -p /usr/src/php/ext/redis \
              && curl -L https://pecl.php.net/get/redis-5.3.3.tgz | tar xvz -C /usr/src/php/ext/redis --strip 1 \
              && echo 'redis' >> /usr/src/php-available-exts \
              && docker-php-ext-install redis \
              && docker-php-ext-install pdo pdo_mysql

AlvinQinwen avatar Apr 06 '21 07:04 AlvinQinwen

ok i fix it because zhe dockerfile need rewrites like this

FROM php:7.4-fpm

#RUN  docker-php-ext-install redis \
#     && docker-php-ext-install pdo pdo_mysql
#ENV PHPREDIS_VERSION 5.0.0 $PHPREDIS_VERSION

RUN apt-get update \
              && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
              && docker-php-ext-configure gd --with-freetype --with-jpeg \
              && docker-php-ext-install -j$(nproc) gd

RUN  mkdir -p /usr/src/php/ext/redis \
              && curl -L https://pecl.php.net/get/redis-5.3.3.tgz | tar xvz -C /usr/src/php/ext/redis --strip 1 \
              && echo 'redis' >> /usr/src/php-available-exts \
              && docker-php-ext-install redis \
              && docker-php-ext-install pdo pdo_mysql

AlvinQinwen avatar Apr 06 '21 07:04 AlvinQinwen

That should be right answer. Thank you docker-php-ext-configure gd --with-freetype --with-jpeg

I solved. "I" hehehe. As I always say and do little: "Look at the documentation".

And the documentation says:

PHP Core Extensions For example, if you want to have a PHP-FPM image with the gd extension, you can inherit the base image that you like, and write your own Dockerfile like this: FROM php:7.4-fpm RUN apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev && docker-php-ext-configure gd --with-freetype --with-jpeg && docker-php-ext-install -j$(nproc) gd

And guess what? It worked.

I hope I have helped those in need: D

khuongphp avatar Aug 09 '21 15:08 khuongphp