Code solutions to PHP, JS, CSS

Spread your code soluces to the world

Love me

Search results for : tags    (9)

Extract images from a page (php)

Getting all IMG sources and ALT from a local or remote page that returns an array. This function uses the DOM API from PHP 5. get_i( file ) = array( att, value )

Sound effects on an action with HTML5 (javascript)

HTML5 has simplified the handling of multimedia files. The simple tag audio replaces the couple object embed with param. A single line of code is sufficient and it is controllable with javascript. In the example below the onmouseout is used to refresh the source of the audio file. In addition to the preload attribute, you can use in the same...

Load image with page scroll.Lazy loading (javascript)

Images are displayed only when they are in the visible area of the window (lazy loading). The code work with the page scrolling. You dont need to modify your HTML code. You can replace the favicon.gif by a blank gif/png.

Extract links from a page (php)

Getting all A HREF links from a local or remote page that returns an array. This function uses the DOM API from PHP 5. get_a( file ) = array( att, value )

Isolate a color (php gd image)

Here is a class to isolate a primary color rendering of a photo black and white. The choice of using Object-oriented programming instead of a function gives the advantage to add filters or other image effects thereafter. Instantiation [code]$obj = new image_effect(); // Optional : ratio size of the working image. default : 2 ...

wordwrap without breaking words (php)

A simple function to cut a character string without breaking words. string wrap_word ( string $str [, int $length = 350] )

Convert unknown text to ISO8859-1 (php)

This method is useful if you get a text field to display in ISO8859-1. In some cases, you do not know if the writer has written characters in UTF8 or ISO. Especially if the text has gone through several transitional stages.

Dynamic image resizing according to location (javascript)

This javascript method resize image according to its location in the page. Images do not overflow the page or div that contains them. It works automatically, it is not necessary to modify the HTML content of the body. Implementation : • copy the javascript code in the header, between <head> and </head> • In the body...

Close HTML tags function (php)

A simple function to close all open HTML tags from text. To be used for example when you propose an editable field with HTML.