Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix centos libzbar1.0 error and add code point return. #37

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Simple extension to read barcodes from images

[![Build Status](https://travis-ci.org/mkoppanen/php-zbarcode.svg?branch=master)](https://travis-ci.org/mkoppanen/php-zbarcode)

## Upgrade at 2022-03-11

Support libzbar1*, And add code point out.

## Upgrade at 2018-12-05

Support PHP7, And fix some bug that may cause crash.
Expand Down
5 changes: 5 additions & 0 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ if test $PHP_ZBARCODE != "no"; then

if $PKG_CONFIG --exists zbar; then
PHP_ZBAR_VERSION=`$PKG_CONFIG zbar --modversion`

if [[[ "$PHP_ZBAR_VERSION" == 0.1* ]]]; then
sed -i 's/, &patch/ /' zbarcode.c
fi

PHP_ZBAR_PREFIX=`$PKG_CONFIG zbar --variable=prefix`

AC_MSG_RESULT([found version $PHP_ZMQ_VERSION, under $PHP_ZBAR_PREFIX])
Expand Down
13 changes: 13 additions & 0 deletions zbarcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,19 @@ zval *s_php_zbarcode_scan_page(zbar_image_scanner_t *scanner, zbar_image_t *imag
symbol_type = zbar_symbol_get_type(symbol);
data = zbar_symbol_get_data(symbol);

int len = zbar_symbol_get_loc_size(symbol);

zval points_array;
array_init(&points_array);
int start=0;
for (;start<len;start++){
zval point_array;
array_init(&point_array);
add_assoc_long(&point_array, "x", zbar_symbol_get_loc_x(symbol,start));
add_assoc_long(&point_array, "y", zbar_symbol_get_loc_y(symbol,start));
add_index_zval(&points_array,start,&point_array);
}
add_assoc_zval(&symbol_array, "point", &points_array);
add_assoc_string(&symbol_array, "data", (char *)data);
add_assoc_string(&symbol_array, "type", (char *)zbar_get_symbol_name(symbol_type));
#ifdef HAVE_ZBAR_SYMBOL_GET_QUALITY
Expand Down