-
Cache static media files with nginx
if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)\?[0-9]+$") { access_log off; expires 31d; break; } # Matching URLs http://domain.com/stylesheets/blog.css?1221178271 if ($request_uri ~* "\.(ico|gif|png|jpe?g|css|js|swf)(\?v\d\d?)?$") { access_log off; expires 31d; break; } # Matching URLs http://domain.com/stylesheets/blog.css http://domain.com/stylesheets/blog.css?v1 http://domain.com/stylesheets/blog.css?v12
-
HTML/CSS: aligner verticalement une image et un texte sur une même ligne
-
En HTML:
-
<img src=“…” align=“absmiddle” /> Texte
-
En CSS :
-
<img src=“…” style=“vertical-align:middle” /> Texte
-
-
Pear::Quickform, callback de vérification des dimensions d’une image avant upload
-
<?php
-
require_once “HTML/QuickForm.php” ;
-
function process()
-
{
-
global $file,$path;
-
if ($file->isUploadedFile()) {
-
$file->moveUploadedFile( $path);
-
print ‘Upload done!’;
-
}
-
else {
-
print “Keine Datei hochgeladen!”;
-
}
-
}
-
function ruleCheckImagesize()
-
{
-
global $file;
-
if ($file->isUploadedFile()) {
-
$meta = $file-> getValue();
-
if($size = @getimagesize( $meta[‘tmp_name’])) {
-
if($size[0] == 640 && $size[1 ] == 480) {
-
return true;
-
}
-
}
-
}
-
return false;
-
}
-
$uploadForm = new HTML_QuickForm( ‘upload_form’, ‘post’);
-
$uploadForm->registerRule( ‘imagesize’, ‘function’, ‘ruleCheckImagesize’ );
-
$path = “d:/www/tmp/”;
-
$file = $uploadForm-> addElement(‘file’, ‘filename’ , ‘File:’);
-
$uploadForm->addRule( ‘filename’, ‘Du musst eine Datei wählen’, ‘uploadedfile’ );
-
$uploadForm->addRule( ‘filename’, ‘Die Datei muss 640x480px gross sein!’, ‘imagesize’);
-
$uploadForm->addElement( ‘submit’, ‘btnUpload’, ‘Upload’ );
-
if ($uploadForm->validate()) {
-
$uploadForm->process( ‘process’, true);
-
}
-
else {
-
$uploadForm->display();
-
}
images” related tags
spirit’s tags
-