Archive for the ‘PHP’ Category

 

[pChar] [FATAL] Pie chart can only accept one serie of data.

The following error: “[FATAL] Pie chart can only accept one serie of data.” can be thrown by pChar.

OCR (Optical Character Recognition) in PHP

Ever wanted to extract text from images using PHP? That doesn’t seem trivial, does it? But you will find it’s not that hard after reading this article, so let’s get started!

 
First- we need an OCR engine. I once written such thing in pure PHP, but it was so slow that it wasn’t usable with bigger images. PHP is just not a perfect thing for such tasks.

 
Luckily there is a free OCR engine available for many platforms- including Windows and Linux that we can use as command-line app…

Pure PHP image library- almost 20 image formats

This time I want to present, for the first time, a non-free library for loading and saving images. It is not free, but it’s quite cheap (19.9 USD) and give you support for almost 20 image formats including tga (targa), ppm (portable pixmap), pgm (portable graymap), pbm (portable bitmap), pfm (portable float map) dds (microsoft’s direct draw surface).

Few very useful PHP functions #2

In this post I would like to present next set of PHP functions that are not super-advanced, but really handy. You can use them freely as they all are licensed under MIT.
I think you might find them useful too.

PHP Warning: POST Content-Length of 1649460972 bytes exceeds the limit of 1073741824 bytes in Unknown on line 0

Recently I wrote an upload script in PHP, set the limits using .htaccess:

php_value upload_max_filesize “1.99G”
php_value post_max_size “1.99G”

and then I got this strange error:

PHP Warning: POST Content-Length of 1649460972 bytes exceeds the limit of 1073741824 bytes in Unknown on line 0

while trying to upload 1.53 GB file. But why the error said I exceeded 1GB limit?

Few very useful PHP functions

In this post I would like to present a few PHP functions which I created for projects I worked on and which I found very useful many times.
The functions are not super-advanced, but really handy. You can use them freely as they all are licensed under MIT.
I think there is a big chance you will find them useful too. If you do- please leave a comment, thanks!

PHP Error: unserialize() [function.unserialize]: Error at offset 118 of 512

Lately I got this error in my script while trying to decode serialized UTF-8 string:

unserialize() [function.unserialize]: Error at offset 118 of 512

Here’s a simple solution I found.

Typekit- another way to use nonstandard fonts on a website

I already described cufon method so now I want to focus on another method- Typekit.
Typekit.com is a website which lets you use over 500 nonstandard, nonwebsafe fonts. If you have a website with less then 25000 pageviews per month then you can use they services for free.

PHP: Nice URL shortener to use from PHP

In this post I would like to present you a nice URL shortening service that you may use from PHP in a very simple way (perhaps simplest possible!).
Let’s say you want to shorten url like this:
http://www.my-website-is-here.com/index.php?subpage
To do this you need this simple code:

$url = ‘http://www.my-website-is-here.com/index.php?subpage’;
$new_url = file_get_contents(‘http://is.gd/api.php?longurl=’ . urlencode($url));

Now you can echo $new_url to see [...]

PHP: Smarty: {foreach} doesn’t render my array

On one of the websites I work I couldn’t render an array in a smarty template. My code looked like this:

{foreach from=$myarray key=mykey item=items}

<h2>{$mykey}</h2>

{foreach from=$items item=it}

{$it.value}

{/foreach}

{/foreach}

I used print_r in my controller to show content of $myarray and it was just fine. After a while I found the error: Zend Framework did not allow me
to work [...]

 
TopOfBlogs Web Development & Design Blogs