https://github.com/claviska/SimpleImage php 5.3 + GD
http://imagine.readthedocs.org/en/latest/index.html php 5.3 GD/imagick
http://phpthumb.sourceforge.net/ php 4+/5 GD/imagick
imagick pamokos: http://www.phpro.org/tutorials/Imagick.html
2015 m. rugpjūčio 28 d., penktadienis
PHP URL shortening functions
Integer konvertavimas.
Jigu tinka - ir _ simboliai
Jigu tinka - ir _ simboliai
function encode($number) {
return strtr(rtrim(base64_encode(pack('i', $number)), '='), '+/', '-_');
}
function decode($base64) {
$number = unpack('i', base64_decode(str_pad(strtr($base64, '-_', '+/'), strlen($base64) % 4, '=')));
return $number[1];
}
jeigu norima tik raidyno ir skaiciu
- function encode($val, $base=62, $chars='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
- // can't handle numbers larger than 2^31-1 = 2147483647
- $str = '';
- do {
- $i = $val % $base;
- $str = $chars[$i] . $str;
- $val = ($val - $i) / $base;
- } while($val > 0);
- return $str;
- }
- function decode($str, $base=62, $chars='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
- $val = 0;
- for($i = 0; $i < $len; ++$i) {
- }
- return $val;
- }
paprastam url konvertavimui
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
2015 m. rugpjūčio 24 d., pirmadienis
jQuery pagination plugin
http://esimakin.github.io/twbs-pagination/
2015 m. rugpjūčio 19 d., trečiadienis
ul > li susitraukinejantis medis su jquery
$('ul li').click(function() {
$(this).parent().find('ul').slideToggle();
});
$(this).parent().find('ul').slideToggle();
});
2015 m. rugpjūčio 11 d., antradienis
Word macro - visu paveikslu dydzio nuresetinimas i 100%
word uzseiviname naujausiu formatu kad nebutu vompability mode. Einame i view -> macro ir sukuriame funkcija
Sub AllGraphicsTo100()
Dim ILS As Word.InlineShape
Dim SHP As Word.shape
For Each ILS In ActiveDocument.InlineShapes
If ILS.Type = wdInlineShapePicture Or ILS.Type = wdInlineShapeLinkedPicture Then
ILS.ScaleHeight = 100
ILS.ScaleWidth = 100
End If
Next ILS
For Each SHP In ActiveDocument.Shapes
If SHP.Type = msoPicture Or SHP.Type = msoLinkedPicture Then
SHP.ScaleHeight 1#, True
SHP.ScaleWidth 1, True
End If
Next SHP
End Sub
Sub AllGraphicsTo100()
Dim ILS As Word.InlineShape
Dim SHP As Word.shape
For Each ILS In ActiveDocument.InlineShapes
If ILS.Type = wdInlineShapePicture Or ILS.Type = wdInlineShapeLinkedPicture Then
ILS.ScaleHeight = 100
ILS.ScaleWidth = 100
End If
Next ILS
For Each SHP In ActiveDocument.Shapes
If SHP.Type = msoPicture Or SHP.Type = msoLinkedPicture Then
SHP.ScaleHeight 1#, True
SHP.ScaleWidth 1, True
End If
Next SHP
End Sub
2015 m. liepos 29 d., trečiadienis
Teksto lygiavimas vertikaliai
This solution will work for a single line and multiple lines of text, but still requires a fixed height container:
<div>
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span>
</div>
The CSS just sizes the
<div>
, then vertically center aligns the <span>
by setting the <div>
's line-height equal to its height, and making the <span>
an inline-block with vertical-align: middle
. Then it sets the line-height back to normal for the <span>
so its contents will flow naturally inside the block.div {
width: 250px;
height: 100px;
line-height: 100px;
text-align: center;
}
span {
display: inline-block;
vertical-align: middle;
line-height: normal;
}
2015 m. liepos 27 d., pirmadienis
memcache
yum install memcached
yum install php-pecl-memcache
apachectl restart
$mkey = 'song_'.$s['id'];
$memcache = new Memcache;
$memcache->connect('localhost', 11211);
$rez = $memcache->get($mkey);
if (!$rez) {
$memcache->set($mkey, 'sdsadasd', MEMCACHE_COMPRESSED, 60*60*24);
}
yum install php-pecl-memcache
apachectl restart
$mkey = 'song_'.$s['id'];
$memcache = new Memcache;
$memcache->connect('localhost', 11211);
$rez = $memcache->get($mkey);
if (!$rez) {
$memcache->set($mkey, 'sdsadasd', MEMCACHE_COMPRESSED, 60*60*24);
}
Užsisakykite:
Pranešimai (Atom)