News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Imagick vs GD
November 28, 2013 @ 18:16:34

In a new post to the SitePoint PHP blog Jacek Barecki has written up a comparison of two of the most widely used PHP image manipulation libraries - Imagick and GD.

If you want to create a thumbnail, apply a filter to an image or transform it in any other way, you will have to employ an image processing library in your PHP application. It means that you will probably choose GD or ImageMagick. But which one supports a wider range of image formats? Maybe one of them is slower than the other? What other criteria should be taken under consideration when choosing the right library?

He compares them on a few different aspects:

  • Availability
  • Supported file types
  • Functionality
  • Performance
  • Coding style
  • Popularity

He also provides three alternatives to using GD or Imagick, most involving outside services or software.

0 comments voice your opinion now!
imagick gd image manipulation library tutorial

Link: http://www.sitepoint.com/imagick-vs-gd/

Leve.rs:
Array Manipulation in PHP, the Correct Way
November 08, 2013 @ 10:08:04

On the Leve.rs blog there's a recent post showing what they consider is the right way to work with arrays in PHP. It shows three things you can do to use PHP's own functionality to more correctly perform some common array operations.

More often than not, when PHP developers debug others' code, the majority of each method is taken up by array manipulations. Spending this much time on array manipulations is a huge hassle when trying to understand any given method. In order to speed up the debugging process, it's important to start writing array manipulations the correct way, first. Here are a few examples of code I have either written myself or had to fix in the past. It is time every PHP developer knows how to manipulate arrays properly!

Their three tips relate to:

  • Merging Arrays
  • Array Value Manipulation (with array_walk)
  • Array Value Manipulation (append with the plus sign, "+")
0 comments voice your opinion now!
array manipulation correct merge value walk plus

Link: http://leve.rs/blog/correct-array-manipulation-in-php/

Mikko Koppanen:
Imagick Refresh Updates
October 07, 2013 @ 09:21:50

Mikko Koppanen has been posted several new items about the updates being made to the Imagick functionality in PHP (added as a PECL extension). In order o posting they are:

The Imagick extension is a more advanced image manipulation library that the built-in GD functionality. You can find out more about the functions and features it offers in its manual page.

0 comments voice your opinion now!
imagick graphics manipulation update bugfix

Link: http://valokuva.org/

PHPBuilder.com:
PHP Arrays Advanced Iteration and Manipulation
December 09, 2011 @ 12:50:11

In this new tutorial from PHPBuilder.com, Jason Gilmore shows you some of the more advanced things you can do with arrays in PHP (specifically in the areas of iterating through them and manipulating their contents).

Sporting more than 70 native array-related functions, PHP's array manipulation capabilities have long been one of the language's most attractive features. [...] There are however many array-related tasks which ask a bit more of the developer than merely knowing what part of the manual one needs to consult. Many such tasks require a somewhat more in-depth understanding of the native features, or are possible only when a bit of imagination is applied to the problem.

In his examples he shows how to do things like sorting a multi-dimensional array, iterating recursively (with the help of a RecursiveArrayIterator), converting an object to an array and doing "natural" sorting on an array's contents.

0 comments voice your opinion now!
array manipulation advanced iteration spl recursive sort


Davey Shafik's Blog:
DateTime Timestamp Parsing
September 20, 2011 @ 11:24:27

In a new post to his blog Davey Shafik looks at parsing dates with DateTime, the new and improved way to handle dates in PHP (well, not so new but definitely improved).

As part of a recent project, I was tasked with taking timestamps returned by an API and displaying fuzzy dates in the final output (e.g. 3hrs ago, in 2 weeks, tomorrow). The timestamp format in question looks like: 2012-09-01T16:20:01-05:00 This format can be found in PHP as the DATE_ATOM or DateTime::ATOM constants, which contain the date() formatter string: Y-m-dTH:i:sP With this in hand, we can now easily parse the timestamp into a useful object.

Parsing the date into a DateTime object is as easy as giving it the date string and telling it how it's formatted. Then you can do all sorts of fun things. He shows how to shift the timezone by name, by time increment - simple (like "1 hour") and more complex (like "1 hour 5 minutes 3 seconds"). You can find out more about the DateTime object in the PHP manual.

0 comments voice your opinion now!
datetime parsing manipulation tutorial


PHPBuilder.com:
10 PHP Tricks for Associative Array Manipulation
December 13, 2010 @ 11:54:34

On PHPBuilder.com there's a new tutorial with ten handy tips you can use to work with associative arrays in your PHP applications.

The associative array -- an indispensable data type used to describe a collection of unique keys and associated values -- is a mainstay of all programming languages, PHP included. [...] Such extensive support can be a bit overwhelming to developers seeking the most effective way to manipulate arrays within their applications. In this article, I'll offer 10 tips that can help you shred, slice and dice your data in countless ways.

His tips include working with the arrays by:

  • Adding Array Elements
  • Swapping Keys and Values
  • Editing Array Values
  • Randomizing Array Order
  • Searching the Array
0 comments voice your opinion now!
associative array manipulation tutorial


PHPBuilder.com:
10 Easy Solutions for PHP String Manipulation
June 03, 2010 @ 10:04:32

If you're relatively new to the PHP language and want a few handy tips on working with strings, you should check out this list of ten things that Jason Gilmore has put together to help you with some common string manipulations.

PHP's capabilities [string manipulation] are so strong that it can sometimes be difficult to determine the best possible approach for accomplishing a particular string-related task. In this article I highlight the ideal solutions to 10 common string manipulation tasks.

Among the methods in his list of transformations, he includes:

  • Truncating Text to Produce a Summary
  • Parsing a CSV File
  • Converting URLs into Hyperlinks
  • Converting Newline Characters to Break Tags
0 comments voice your opinion now!
string manipulation tutorial introductory


Michael Maclean's Blog:
Handling fonts in PECL/Cairo
March 02, 2010 @ 12:42:43

Michael Maclean has a look at working with fonts in Cairo (a graphics manipulation extension in the PECL repository). The example will be added to the PHP manual too in case you need it for reference later.

Currently, in PECL/Cairo the only way to draw text is the referred to as the "toy" text API, which is a very basic way of handling text compared to the facilities available in the Cairo library itself. However, it's sufficient for most purposes that I've come across so far.

With the first versions of the Cairo extension, you had to use the selectFontFace method to choose the font you wanted. With the introduction of Cairo 0.2.0, you can now use FreeType font support instead and can use the streams API built into PHP to locate the resource. A snippet of code is included to show how that would work.

0 comments voice your opinion now!
cairo graphic manipulation extension font freetype


Sameer Borate's Blog:
Easy manipulation of URLs
November 10, 2009 @ 12:48:49

On his codediesel.com blog today Sameer Borate has a quick post looking at URL manipulation with the help of the Net_URL2 PEAR package.

Whether you are dynamically creating urls or changing existing ones, manipulation of urls is a frequent coding requirement during development; doing the same on short urls is easy, but quickly becomes complex for urls which have larger query parameters.

He shows how to use the package to parse the current URL into its respective parts (host, port, path, etc) and how to automatically change certain parameters in the current URL and push the updated version back out the other side. There's also a bit there at the end on normalizing URLs.

0 comments voice your opinion now!
url manipulation pear neturl2 package


Kae Verens' Blog:
php and jquery chp7 image manipulation
July 20, 2009 @ 09:17:48

Kae Verens has a new post to his blog looking at a form of non-destructive image manipulation - using the URL of the request to determine the changes that need to be made.

The solution is to not actually create copies, but to record the changes applied to the original image in the URL of your manipulated image. When the server is asked for those URLs, it runs the manipulations on the original image and gives you back the new image. Of course, we will cache the new manipulations so this doesn't need to be done every time, but this now allows you to replace the original image, then clear the cache, forcing all the variants of it to refresh, without you needing to do it again.

A demo of the script in action is included in the post as well as a link to download the script doing the work.

0 comments voice your opinion now!
cache url manipulation image



Community Events





Don't see your event here?
Let us know!


api laravel release developer list interview configure podcast threedevsandamaybe code symfony language library series application introduction community wordpress install bugfix

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework