Marcel Eichner // Ephigenia

  • Home
  • Illustration
  • Code
  • Kontakt

Aktuelle Projekte

Horrorblog.org
jQuery.slideShow
Franklin
code.marceleichner.de

This Blog-Website is built with Harrison!

Blogs & Freunde

Gimmixx
Martin Fleck
Torsten Bergler
Jens Franke
Robokid
Peter Kröner
Polycoder
Coding Horror
Lotterliebe
CodeBalancer
Pseudocoder
Migrador
Dachdeckermeister Peter Arold in Werda, Plauen, Hof und Umgebung La Petite Provence - Pension und Festsaal in Leisnig Piv-Berlin, Immobilienverwaltung Verwaltung Berlin blogoscoop

#507

04.07.2011 19:51
0 Kommentare
Share
  • php
  • apache
  • gd-lib
  • image
  • server
  • nginx
  • static
  • content
  • delivery
  • .htaccess
One problem when relaunching large projects with a ton of images is to re-create all the thumbnails that users have uploaded in the years. If you don’t use paperclip (ruby) or anything like it in PHP (is there any like it!?) where you can run run one command to re-create all the thumbnails in all specified sizes your can try to keep it flexible and create every image on demand.

Theory

The Webserver should serve the image if it exists. If the file does not exist, the request should be redirected to a PHP script that searches and creates the requested image file (in requested size) at exactly the location it was originally requested. The second request on the file will not be redirected to the PHP script and will server the image that now exists.

Practice

So the first thing to archive is to send the request of a not existing image to a PHP file. That’s easy if you’re familiar with all the nginx directives:

This rule can be combined with the anti-hotlinking rules for images with nginx I showed you last week.

After that we need to create a format that includes width and height of any requested image so that the
thumbnailer.php
knows which size the created image should have. A valid request for a resized file should always have all parameters (width, height) in it:
../img/public/9c4be029/438xauto/filename.jpg

This makes it easy to split up width, height with a regexp in
thumbnailer.php
. The following code is just an example. You’re surelly integrate the logic into your frameworks:

That’s it! After that you can request any image in any size on your webserver by only creating it once it’s requested.

There are some things you can add, like other parameters in the
$formatRegexp
string to add different resizing methods or even filters, or limitations on the
width
and
height
parameter.

Appendix: Apache

It’s almost the same thing with apache. Just add a few lines to your
.htaccess.
and all your image requests are redirected to the thumbnailer (or anything):

#503

14.07.2010 11:40
0 Kommentare
Share
  • firefox
  • tool
  • open
  • source
  • console
  • Nerd
  • extension
Screenshot vom Vimperator in Aktion
Auf dem LinuxTag 2010 hat Caspar die Vimperator Erweiterung für den Firefox Browser vorgestellt die ich mir zu Hause gleich zu Gemüte geführt habe.

Die Erweiterung ist total für Nerds gedacht. Man kann den kompletten Browser, alle Links und Befehle von der durch den Vimperator hinzugefügten Kommandozeile aufrufen. So bekommt man noch mal mindestens 100 Pixel in der Höhe Platz für die Websites und gerade auf Netbooks ist das eine Menge Platz!

Nach einer leichten Einführungsphase um die wichtigsten Befehle wie
o www.spon.de[ENTER]
für Seite aufrufen oder
t www.horrorblog.org[ENTER]
für Tab öffnen zu lernen hab ich mir mitlerweile die komplette Bedienung zugelegt und auch schon mein erstes "Plugin" geschrieben das mit die aktuelle URL mit Bitly als ShortURL in die Zwischenablage legt. Hier meine eigene
.vimperatorrc
Datei die noch ein paar mehr Sachen macht:
" only use with buftabs plugin
set showtabline=0
"
custom colorsheme
colorscheme darkness
" set textmate as editr

set editor="mate -w"
" show hover links in status bar

set showstatuslinks=2
js document.getElementById("status-bar").setAttribute("moz-collapsed", false);
" no error sound, just flash display

set errorbells visualbell
" alternative tab navigation

map b gt
map v gT
" tab navigation via arrow keys

map <Left> <C-p>
map <Right> <C-n>
map h <C-p>
map l <C-n>
" bit.ly shortener.

javascript <<EOF
shortenURLIsGd = function (url) {
  var req = new XMLHttpRequest();
  " get your username and api key from bit.ly!!!

  req.open("GET", "http://api.bit.ly/v3/shorten?login=[Username]&apiKey=[API_KEY]&format=txt&longUrl=" + escape(url), true)
  req.onreadystatechange = function (ev) {
    if (req.readyState == 4) {
      if (req.status == 200) {
        util.copyToClipboard(req.responseText, true);
      } else {
        liberator.echo(req.responseText);
      }
    }
  }
  req.send(null);
}
EOF
map <silent> short :javascript shortenURLIsGd(buffer.URL);<CR>
map <silent> bitly :javascript shortenURLIsGd(buffer.URL);<CR>

Des weiteren sei noch erwähnt, dass man noch weitere ColorShemes oder Vimperator Plugins im Internet findet. Ein super Plugin ist auch das Buftabs Plugin, dass sogar die Tableiste überflüssig macht.

[UPDATE #1] Dank der Aktualisierung von Geshi, das das Code-Highlighting hier im Blog erledigt sieht das Vim-Script jetzt auch schön bunt aus.

#470

15.07.2009 16:37
0 Kommentare
Share
  • code
  • javascript
  • script
  • klassen
  • lib
Oh mann, was für ein Pain-in-the-ass ... wenn man echte Klassen in Javascript haben möchte kann man sich so ziemlich tot googeln und man wird jedes mal nur 50% von dem finden was man eigentlich sucht wenn man echte Klassen mit Vererbung in JavaScript haben möchte.
Glücklicherweise gibt es Leute denen das auch schon so gegangen ist und die eine wirklich einfach zu nutzende und kleine Bibliothek für echte Ruby-like Klassen in JavaScript geschrieben haben: JS.Class Ein weiter Vorteil ist, dass man JS.Class anstandslos mit jQuery benutzen kann, was von kleineren Code-Snippets die Klassenverhalten simulieren soll nicht gerade sagen kann.
Wer erst abgeschreckt ist von den vielen Dateien sei beruhigt. Für einfache Klassen reicht schon das core.js was minified nur 7434 Bytes gross ist. Eine echte Zeitersparnis!

#457

05.06.2009 13:49
0 Kommentare
Share
  • code
  • osx
  • App
  • terminal
  • tool
  • script
  • scripting
  • apple
iTerm ist eine willkommene Alternative zu der nativen Terminal App für OSX. Jetzt kann man die auch mit AppleScript verwursten.
Wenn man es Leid ist immer wieder die selben Terminal Fenster aufzumachen um Apache-Logs zu lesen oder die Datenbank zu überwachen sollte man überlegen ob das nicht noch besser geht. Klaro geht das besser! Mit Apple-Script!
tell application "iTerm"
  activate
 
  -- create server log terminal
  make new terminal
  tell the last terminal
    activate current session
    launch session "Default Session"
    tell the last session
      write text "clear;"
      write text "tail -f /Applications/MAMP/logs/apache_access.log"
      set background color to {15000, 200, 200}
    end tell
  end tell
  set the bounds of the first window to {0, 700, 840, 900}
  set the name of the first window to "apace_access.log"
 
  -- creat working terminal
  make new terminal
  tell the last terminal
    activate current session
    launch session "Default Session"
    tell the last session
      write text "welcome user, start now"
    end tell
  end tell
  set the bounds of the first window to {0, 0, 840, 660}
  set the name of the first window to "workspace"
 
end tell
So kann man ganze Fenster Setups zusammencoden und erspart sich so hoffentlich einen Haufen Zeit.

Nachtrag:
Man kann dann das Apple-Script auch automatisch bei jedem Start von iTerm ausführen lassen indem man es in ~/Library/iTerm/AutoLaunch.scpt ablegt. Weitere Beispiele gibt es auf der Scripting Seite von iTerm.

#452

06.05.2009 14:50
0 Kommentare
Share
  • code
  • php
  • thumbnail
  • gd-lib
  • image
Seit letzter Woche sind die Thumbnails auf dieser Seite ein wenig schärfer geworden!
Die GD-Lib in PHP erzeugt unscharfe Thumbnails. Wenn man Convolution-Filter auf das fertige Thumbnail anwendet bekommt man allerdings wunderbar scharfe Thumbnails:
// angenommen $h ist das image-handle
$m = array(
  array(-1, -1, -1),
  array(-1, 16, -1),
  array(-1, -1, -1)
);
imageconvolution($h, $m, 8, 0);
Viel Spass damit!

#449

31.03.2009 14:14
0 Kommentare
Share
  • osx
  • tip
  • tool
  • apple
  • quartz
  • filter
  • pdf
  • print
Ich hatte gerade das Problem das ich ein gescanntes PDF mit mehreren Seiten verkleinern wollte. Leider kann man das ohne die Adobe Acrobat Professional Version in der man einfach als PDF drucken kann nicht so mir nichts dir nichts am mac erledigen.
Ein paar Minuten mit Google verbracht und schon gibt es die Lösung! Einfach die Quartz Filter aus diesem Zip hier in ~/Library/Filters packen und schon kann man sehr einfach Dateien in der Vorschau als PDF mit weniger DPI speichern.

#398

15.07.2008 22:24
0 Kommentare
Share
  • programmieren
  • tutorial
  • Web
  • fundstücke
  • framework
  • UI
  • Usability
  • Guide
  • Pattern
Hab ich glaube ich schon vor ein paar Wochen gefunden. In der Yahoo Design Pattern Library gibts Lösungen für oft gefragte Fragen wenn man Websites baut. Hauptsächlich für Communities. Altbewährtes und auch neue Sachen. Verständlich erklärt und schön sortiert.

#105

13.12.2004 13:43
0 Kommentare
Share

Endlich ist es so weit. Das Freewave Buch mit Illus von mir drin kann man jetzt endlich käuflich erwerben!

#63

11.10.2004 11:25
2 Kommentare
Share
  • illustration
  • book
  • reference
  • Booth-Clibborn
Year, es ist da, glaub ich, Dave hats in den Händen:

#35

16.07.2004 20:12
0 Kommentare
Share

Huijui jetzt ist es wohl hochoffiziell im September kommt das Freeware Fontmonster Buch für das ich im letzten Jahr ein paar Illustrationen gemacht habe. Auf 6 Seiten kann man diese dann bestaunen. Als vorab gibt es hier einen Scan von der Titelseite und 2 Seiten aus dem offiziellen Herbstkatalog von Booth-Clibborn aus UK die das Buch verlegen.
marceleichner HTML5 Harrison Theme (Validate Source), © 2010 by Ephigenia M. Eichner, Impressum