Create responsive images on the fly with php and Imagick

To improve paging loading performance across multiple devices, web developers can provide each image in different resolutions using the srcset attribute and let the browser choose which one to load e.g.:

Vector tiles with PostGIS, PHP and OpenLayers

This is an example about how to create vector tiles with PostGIS 3.3 (and PostgreSQL 15.3), serve them with PHP 8.1 and use them in OpenLayers 7.5. In contrast to the few tutorials available on the internet, it not only uses the latest PostGIS version 3.3, which further simplified the generation of vector tiles by …

Multiple OCI8 and PHP versions in parallel

You can easily switch between multiple versions of PHP with: But if you installed the Oracle oci8 extension, you will probably run into the error, that it can not be loaded when switching to the older php version: Unable to load dynamic library ‘oci8.so’ This happens, because pecl uninstalls the previous oci8 version automatically unless …

Docker: How to install the php enchant extension

If I try to install the php enchant extension in the docker image php:8.1-fpm with RUN docker-php-ext-install enchant I get the following error: E: Unable to locate package libenchant-2 You need to install the missing enchant library in the dockerfile yourself (along with your wanted spellcheck language, in my case Swiss German): RUN apt-get install …

Quick Tip: Access Oracle LOB directly from PHP

Access the data from a clob/blob field without having to call OCI-Lob->load() first When you fetch (binary) data from an Oracle database field of type BLOB or CLOB with OCI8, the (binary) large object is normally returned as LOB descriptor (an instance of the OCI-Lob class). To retrieve the data, you have to call the …

PHP and SQLite FTS4: How to process the matchinfo function part II

Understanding the output from the matchinfo() function Part I: Reading the binary output from the matchinfo() function To analyze what the output of the matchinfo() function means, we’ll use a different example dataset than the one from the SQLite FTS4 documentation. Since I’m a bird photographer, let’s create a virtual FTS4 table holding information about …

PHP and SQLite FTS4: How to process the matchinfo function part I

Reading the binary output from the matchinfo() function SQLite’s MATCHINFO() function provides metrics that are useful for filtering or sorting results of a query according to relevance. The function returns a binary string representing a variable number of 32-bit unsigned integers in machine byte-order. It can be read into an array of integers using the …

SQLite FTS4: Standard vs Enhanced Query Syntax

The SQLite documentation talks about two ways to perform full text queries: standard or enhanced query syntax. Be aware: which one is available depends on how SQLite was compiled. You might, like me, run into troubles when developing locally using one syntax and then publishing remotely only to find out your query does not return …

How to install ExifTool with Composer

I’m working on a PHP project, that uses Phil Harveys excellent ExifTool to read Exif and XMP tags from photos. Since ExifTool is written in Perl, there is of course no composer.json to install this dependency directly with Composer. But you can create your own package information in your master composer.json as follows: { … …

How to update Composer on Linux Mint 18.3

When you install Composer (the dependency manager for PHP) globally on Linux Mint 18.3 with the package manager… $ sudo apt install composer $ composer -V Composer version @package_branch_alias_version@ (1.0.0-beta2) 2016-03-27 16:00:34 …you’ll get the totally outdated version 1.0.0-beta2. The problem is that this version does not support extracting compressed package files ‘tar.gz’. It also …