Imagick php mac os

Установка ImageMagick Brew с модулем PHP в Mac OS X

Я установил ImageMagick, используя программу для brew install imagemagick . Все это работало нормально, и я могу запустить любую команду ImageMagick из командной строки Terminal / Command.

Теперь, когда я пытаюсь использовать классы ImageMagick в PHP, я получаю ошибку Class ‘Imagick’ not found in . Я думаю, это потому, что модуль ImageMagick не загружен.

Может ли кто-нибудь помочь мне заставить эту работу работать на PHP? Благодаря!

Дополнительная информация:
Версия для Mac OS X: 10.8: Горный лев
Версия PHP : 5.3.13

Недостаточно установки ImageMagick. Вам также нужен пакет Imagick (возможно, называемый php5-imagick или подобный для варки).

Imagick не выполняет самую работу, это родное расширение PHP для создания и изменения изображений с использованием API ImageMagick .

Попытайтесь найти точное название пакета с помощью brew search imagick .

Я просто сделал это после много экспериментов. На данный момент это, по-видимому, способ сделать это для php 5.3:

Не знаю, кто Хосе Гонсалес, но, видимо, мы находимся в его долге ….

Я использую Йосемити. Для меня решение представляет собой комбинацию ответа и комментариев, которые уже перечислены здесь.

Измените /etc/php.ini, чтобы включить imagick

Я была такая же проблема. Это шаги, которые работали для меня, если вы используете php 5.6

Источник

Установка ImageMagick и подключение PHP-модуля imagick на Mac OS X

Чтобы установить и протестировать связку ImageMagick + imagick, необходимо вначале сконфигурировать локальный веб-сервер Apache, подключить PHP и поставить MacPorts. Подробную информацию можно найти по следующим ссылкам:

ImageMagick — графическая библиотека для пакетной работы над изображениями, может использоваться как самостоятельное приложение со своим GUI, так и через интерфейс командной строки, понимает более 100 форматов и может выполнять многие функции по обработке изображений. Имеет огромное количество интерфейсов реализованных на многих популярных языках для более удобного использования библиотеки в своих скриптах и сценариях через программный интерфейс.

Установка ImageMagick

Установить ImageMagick на Mac OS X можно с помощью бинарного дистрибутива или через систему управления пакетами MacPorts, на официальном сайте рекомендуется использовать именно второй способ. Не смотря на кажущуюся простоту установки библиотеки из бинарника, заставить работать его с модулем imagick мне так и не удалось.

Для установки ImageMagick через MacPorts достаточно ввести команду:

sudo port install imagemagick

Теперь придется подождать, т.к. установка будет длиться примерно 45 минут. Когда установка будет завершена, можно проверить работоспособность библиотеки, переходим в терминал и вводим следующие команды:

sudo convert logo: logo.gif
identify logo.gif
display logo.gif

Если библиотека установилась корректно, то мы увидим логотип ImageMagick.

Установка модуля imagick

imagick — это интерфейс для работы с библиотекой ImageMagick, который позволяет обращаться к командам с помощью сценариев PHP.

Модуль imagick можно скомпилировать самостоятельно или установить как PECL-расширение, во втором случае потребуется установить систему управления классами PEAR, второй способ наиболее простой и более практичный, его и рассмотрим:

Для начала установим PEAR. Переходим в терминал и вводим следующие команды:

curl http://pear.php.net/go-pear > go-pear.php
sudo php -q go-pear.php

После выполнения второй команды мы увидим приветствие PEAR с предложением продолжить установку, нажимаем Enter, далее нам будет предложено указать HTTP proxy, по прежнему нажимаем Enter.

Если вы получаете следующее сообщение:

«Sorry! Your PHP version is too new (5.3.3) for this go-pear.
Instead use http://pear.php.net/go-pear.phar for a more stable and current
version of go-pear, more suited to your PHP version.»

то необходимо внести изменения в файл php.ini

sudo nano /etc/php.ini

Необходимо найти блок [Phar] и раскомментировать в нем строки:

Читайте также:  Bitlocker windows как разблокировать жесткий диск

phar.readonly = On
phar.require_hash = On

В строке phar.require_hash значение On поменять на значение Off . И добавить строку detect_unicode = Off .

Перезапускаем Apache и выполняем следующие команды:

curl http://pear.php.net/go-pear.phar > go-pear.phar
sudo php -q go-pear.phar

В следующем диалоге нам будет предложено указать расположение компонентов PEAR, выбираем значение 1 и вводим начале вводим путь к каталогу ($prefix):

Нажимаем Enter и продолжаем установку (необходимо согласиться с установкой).

Установим модуль imagick:

sudo pecl install imagick

В процессе установки будет предложено выбрать каталог с библиотекой ImageMagick, если она установлена через MacPorts, то вводим путь /opt/local и продолжаем установку.

Переходим к файлу php.ini и добавляем следующую строку:

Перезагружаем веб-сервер Apache.

Комментарии (2):

А как настроить на ubuntu? Помогите плиз, могу за денюшку. Нужно очень и срочно!

Андрей

Потребовалось установить более новую версию php — 5.4. Ставил следующим образом:

В данном случае php не обновляется, а устанавливается новая версия в другую папку /usr/loca/php5/bin

При установке Imagick по инструкции везде менял пути к php на сооветствующие, но все равно в результате создался файл imagick.so в папке расширений для php старой версии, пытался подключить эту версию но расширение не подключается, выдает ошибку

Module compiled with module API=20090626
PHP compiled with module API=20100525

Источник

Install PHP’s imagick extension on Mac with Brew

Mattias Geniar, October 16, 2019

Follow me on Twitter as @mattiasgeniar

I was setting up a new Mac and ran into this problem again, where a default PHP installation with brew is missing a few important extensions. In this case, I wanted to get the imagick extension loaded.

This guide assumes you have Homebrew installed and you’ve installed PHP with brew install php .

Install Image Magick dependency

First, install imagemagick itself. This is needed to get the source files you’ll use later to compile the PHP extension with.

This will also install the needed pkg-install dependency.

Compile Imagick PHP extension with pecl

Next up, use pecl to get the PHP extension compiled.

It will also auto-register itself in your php.ini and should now be available.

Note: if you run php-fpm, make sure you to restart your daemon to load the latest extension. Use brew services restart php .

Permission denied errors?

You may get failed to open stream: Permission denied errors when trying to perform a pecl install. It shouldn’t happen, because Homebrew by default installs everything in local folders, but in case you do get that error you can prefix the commands with sudo like this.

Table of contents

Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.

Who dis? 🤔

Hi! I’m Mattias Geniar, an independent developer, Linux sysadmin & general problem solver. Looking for help? I’m available for hire as a consultant. Want to get in touch? Have a look at my contact page.

Источник

Download

You can install ImageMagick from source. However, if you don’t have a proper development environment or if you’re anxious to get started, download a ready-to-run Linux or Windows executable. Before you download, you may want to review recent changes to the ImageMagick distribution.

ImageMagick source and binary distributions are available from a variety of FTP and Web mirrors around the world.

Linux Binary Release

These are the Linux variations that we support. If your system is not on the list, try installing from source. Although ImageMagick runs fine on a single core computer, it automagically runs in parallel on multi-core systems reducing run times considerably.

Version Description
magick Complete portable application on Linux, no installation required. Just download and run. AppImages require FUSE and libc to run. Many distributions have a working FUSE setup out-of-the-box. However if it is not working for you, you must install and configure FUSE manually.
ImageMagick-7.1.0-9.x86_64.rpm Redhat / CentOS 8.3 x86_64 RPM
ImageMagick-libs-7.1.0-9.x86_64.rpm Redhat / CentOS 8.3 x86_64 RPM
ImageMagick RPM’s Development, Perl, C++, and documentation RPM’s.
ImageMagick-i386-pc-solaris2.11.tar.gz Solaris Sparc 2.11
ImageMagick-i686-pc-cygwin.tar.gz Cygwin
ImageMagick-i686-pc-mingw32.tar.gz MinGW

ImageMagick RPM’s are self-installing. Simply type the following command and you’re ready to start using ImageMagick:

You’ll need the libraries as well:

Note, if there are missing dependencies, install them from the EPEL repo.

For other systems, create (or choose) a directory to install the package into and change to that directory, for example:

Next, extract the contents of the package. For example:

Set the MAGICK_HOME environment variable to the path where you extracted the ImageMagick files. For example:

If the bin subdirectory of the extracted package is not already in your executable search path, add it to your PATH environment variable. For example:

On Linux and Solaris machines add $MAGICK_HOME/lib to the LD_LIBRARY_PATH environment variable:

Finally, to verify ImageMagick is working properly, type the following on the command line:

Congratulations, you have a working ImageMagick distribution under Linux or Linux and you are ready to use ImageMagick to convert, compose, or edit your images or perhaps you’ll want to use one of the Application Program Interfaces for C, C++, Perl, and others.

Mac OS X Binary Release

We recommend Homebrew which provides pre-built binaries for Mac (some users prefer MacPorts). Download HomeBrew and type:

ImageMagick depends on Ghostscript fonts. To install them, type:

The brew command downloads and installs ImageMagick with many of its delegate libraries (e.g. JPEG, PNG, Freetype, etc). Homebrew no longer allows configurable builds; if you need different compile options (e.g. librsvg support), you can download the ImageMagick Mac OS X distribution we provide:

Create (or choose) a directory to install the package into and change to that directory, for example:

Next, extract the contents of the package. For example:

Set the MAGICK_HOME environment variable to the path where you extracted the ImageMagick files. For example:

If the bin subdirectory of the extracted package is not already in your executable search path, add it to your PATH environment variable. For example:

Set the DYLD_LIBRARY_PATH environment variable:

Finally, to verify ImageMagick is working properly, type the following on the command line:

Note, the display program requires the X11 server available on your Mac OS X installation DVD. Once that is installed, you will also need to set export DISPLAY=:0 .

The best way to deal with all the exports is to put them at the end of your .profile file

Congratulations, you have a working ImageMagick distribution under Mac OS X and you are ready to use ImageMagick to convert, compose, or edit your images or perhaps you’ll want to use one of the Application Program Interfaces for C, C++, Perl, and others.

iOS Binary Release

Claudio provides iOS builds of ImageMagick.

Download iOS Distribution

You can download the iOS distribution directly from ImageMagick’s repository.

There are always 2 packages for the compiled ImageMagick:

The first one includes headers and compiled libraries that have been used to compile ImageMagick. Most users would need this one.

ImageMagick compiling script for iOS OS and iOS Simulator

To run the script:

where VERSION is the version of ImageMagick you want to compile (i.e.: 7.1.0-9, svn, . )

This script compiles ImageMagick as a static library to be included in iOS projects and adds support for

Upon successful compilation a folder called IMPORT_ME is created on your

/Desktop . You can import it into your Xcode project.

Xcode project settings

After including everything into Xcode please also make sure to have these settings (Build tab of the project information):

  • Other Linker Flags: -lMagickCore-Q16 -lMagickWand-Q16 -ljpeg -lpng -lbz2 -lz
  • Header Search Paths: $(SRCROOT) — make it Recursive
  • Library Search Paths: $(SRCROOT) — make it Recursive

On the lower left click on the small-wheel and select: Add User-Defined Setting

  • Key: OTHER_CFLAGS
  • Value: -Dmacintosh=1

Sample project

A sample project is available for download. It is not updated too often, but it does give an idea of all the settings and some ways to play around with ImageMagick in an iOS application.

Windows Binary Release

ImageMagick runs on Windows 10 (x86 & x64), Windows 8 (x86 & x64), Windows 7 (x86 & x64), Windows Server 2012, Windows Vista (x86 & x64) with Service Pack 2, Windows Server 2008 (x86 & x64) with Service Pack 2, and Windows Server 2008 R2 (x64).

The amount of memory can be an important factor, especially if you intend to work on large images. A minimum of 512 MB of RAM is recommended, but the more RAM the better. Although ImageMagick runs well on a single core computer, it automagically runs in parallel on multi-core systems reducing run times considerably.

The Windows version of ImageMagick is self-installing. Simply click on the appropriate version below and it will launch itself and ask you a few installation questions. Versions with Q8 in the name are 8 bits-per-pixel component (e.g. 8-bit red, 8-bit green, etc.), whereas, Q16 in the filename are 16 bits-per-pixel component. A Q16 version permits you to read or write 16-bit images without losing precision but requires twice as much resources as the Q8 version. Versions with dll in the filename include ImageMagick libraries as dynamic link libraries. Unless you have a Windows 32-bit OS, we recommend this version of ImageMagick for 64-bit Windows:

Version Description
ImageMagick-x86_64-apple-darwin20.1.0.tar.gz macOS High Sierra
Version Description
ImageMagick-7.1.0-9-Q16-HDRI-x64-dll.exe Win64 dynamic at 16 bits-per-pixel component with High-dynamic-range imaging enabled

Or choose from these alternate Windows binary distributions:

To verify ImageMagick is working properly, type the following in a Command Prompt window:

If you have any problems, you likely need vcomp120.dll . To install it, download Visual C++ Redistributable Package.

Note, use a double quote ( » ) rather than a single quote ( ‘ ) for the ImageMagick command line under Windows:

Use two double quotes for VBScript scripts:

Congratulations, you have a working ImageMagick distribution under Windows and you are ready to use ImageMagick to convert, compose, or edit your images or perhaps you’ll want to use one of the Application Program Interfaces for C, C++, Perl, and others.

© 1999-2021 ImageMagick Studio LLC

Источник

Читайте также:  Perl modules installed linux
Оцените статью
Version Description
ImageMagick-7.1.0-9-Q16-x64-static.exe Win64 static at 16 bits-per-pixel component
ImageMagick-7.1.0-9-Q8-x64-dll.exe Win64 dynamic at 8 bits-per-pixel component
ImageMagick-7.1.0-9-Q8-x64-static.exe Win64 static at 8 bits-per-pixel component
ImageMagick-7.1.0-9-Q16-x64-dll.exe Win64 dynamic at 16 bits-per-pixel component
ImageMagick-7.1.0-9-Q16-HDRI-x64-dll.exe Win64 dynamic at 16 bits-per-pixel component with high dynamic-range imaging enabled
ImageMagick-7.1.0-9-Q16-HDRI-x64-static.exe Win64 static at 16 bits-per-pixel component with high dynamic-range imaging enabled
ImageMagick-7.1.0-9-Q16-x86-dll.exe Win32 dynamic at 16 bits-per-pixel component
ImageMagick-7.1.0-9-Q16-x86-static.exe Win32 static at 16 bits-per-pixel component
ImageMagick-7.1.0-9-Q8-x86-dll.exe Win32 dynamic at 8 bits-per-pixel component
ImageMagick-7.1.0-9-Q8-x86-static.exe Win32 static at 8 bits-per-pixel component
ImageMagick-7.1.0-9-Q16-HDRI-x86-dll.exe Win32 dynamic at 16 bits-per-pixel component with high dynamic-range imaging enabled
ImageMagick-7.1.0-9-Q16-HDRI-x86-static.exe Win32 static at 16 bits-per-pixel component with high dynamic-range imaging enabled
ImageMagick-7.1.0-portable-Q16-x64.zip Portable Win64 static at 16 bits-per-pixel component. Just copy to your host and run (no installer, no Windows registry entries).
ImageMagick-7.1.0-portable-Q16-x86.zip Portable Win32 static at 16 bits-per-pixel component. Just copy to your host and run (no installer, no Windows registry entries).
ImageMagick-7.1.0-portable-Q8-x64.zip Portable Win64 static at 8 bits-per-pixel component. Just copy to your host and run (no installer, no Windows registry entries).
ImageMagick-7.1.0-portable-Q8-x86.zip Portable Win32 static at 8 bits-per-pixel component. Just copy to your host and run (no installer, no Windows registry entries).
ImageMagick-7.1.0-portable-Q16-HDRI-x64.zip Portable Win64 static at 16 bits-per-pixel component with high dynamic-range imaging enabled. Just copy to your host and run (no installer, no Windows registry entries).
ImageMagick-7.1.0-portable-Q16-HDRI-x86.zip Portable Win32 static at 16 bits-per-pixel component with high dynamic-range imaging enabled. Just copy to your host and run (no installer, no Windows registry entries).