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):

#441

25.01.2009 15:41
0 Kommentare
Share
  • berlin
  • Portfolio
  • Web
  • freunde
  • seele
  • Relaunch
Max Lisewski, einer meiner Lieblings-Wegbestreiter durchs Leben hat nach erstaunlich kurzer Zeit seine neues Portfolio online gestellt. Eigentlich wäre ich ja noch vor DMIG oder Kai dran gewesen, aber wenn man was bis Montag unterm Tisch halten will klappt das nicht immer. Schöne Verselbständigung :)
Na auf jeden Fall freu ich mich, dass Max seine Studienzeit erfolgreich mit seiner Diplomarbeit über das Prokrastinieren abgeschlossen hat und auch endlich wieder in Berlin ist. Freue mich auf weitere Jahre der Zusammenarbeit und Freundschaft! m/ rock on!

#428

15.12.2008 18:18
0 Kommentare
Share
  • berlin
  • Web
  • freunde
  • tipp
  • Redesign
  • Schumann
  • Combo
Richard hat die Seite für seine Schumanncombo erneut umgestaltet. Als logische Konsequenz ganz pragmatisch und mit (endlich) schön großen Bildern! Auch die erste schöne Anwendung vom Typeface JS die ich sehe.
An Einfachheit eigentlich nicht zu schlagen :)

#421

01.12.2008 02:09
7 Kommentare
Share
  • code
  • seele
  • Relaunch
Okay!

So geht ein Soft-Launch! Einfach Domains derbe umrouten und verlinken, genervt sein von dem vielen Inhalt den man Pflegen muss und am liebsten neu schreiben würde. Hammer!

Das ist ein temporärer Blogeintrag für alle die es mitbekommen. Großer Launch mit korrekter URL in ein paar Tagen würd’ ich sagen :) Blog is online - mit korrekter Domain und pipapo!

Nach 4 1/2 Jahren endlich geschafft :) Yes!

#403

30.07.2008 23:29
1 Kommentar
Share
  • code
  • php
  • Web
  • fundstücke
  • Termine
  • seele
  • Relaunch
Tripsbytips ist back!!!
Mit verbessertem Konzept zu Bewertungen und Empfehlungen (alle Empfehlungen von Freunden sind jetzt wichtiger als alle anderen und noch mehr), und komplett neu gebautem Allem! Die Jungs dahinter, Uwe Frers und sein Team haben sich wortwörtlich die Nächte um die Ohren gehauen. Das hab ich selbst mitbekommen. Die neue Seite macht einen total besseren Eindruck und es kann losghen! Meldet euch an und added mich!
Es ist eh alles viel einfacher geworden ... Du hast einen nützlichen Tipp und willst ihn loswerden? Alles klar, einfach Text eingeben, Tipp abgeben drücken und schon ist es drin! Alle Empfehlungen von Freunden werden durch kleine Herzchen gekennzeichnet und ach was red ich! Geht einfach mal drauf und zieht's euch rein!
Wer mir 'nen Drink ausgibt bekommt ein Dankeschön :D
marceleichner HTML5 Harrison Theme (Validate Source), © 2010 by Ephigenia M. Eichner, Impressum