Beiträge

[PHP] NextGEN Gallery – Sortierung der Galerien – Teil 2

Hallo,

ich hatte ja schon mal darüber geschrieben wie man die Bilder einer NextGen Galerie sortieren kann. Damals musste man sich noch durch den Code hangeln und ihn ändern… und beim nächsten Update war alles wieder futsch.

Jetzt habe ich vor ein paar Tagen eine elegantere Lösung gefunden. Die Galerie unterstützt nämlich die Zusammenarbeit mit benutzerdefinierten Feldern. Leider ist diese Information nicht einfach zu finden.

Aber um was geht es überhaupt genau?

Ich habe zum Beispiel meine Alben in den Galerien rückwärts Sortiert. Damit der Besucher immer oben die neusten Bilder sieht. Das macht Sinn, denke ich.
Nun erstellen wir einen Artikel und möchten dort auch ein Album einfügen. Weil man gerade etwas tolles Besucht hat und zig Fotos davon gemacht hat und man ein eigenes Album dafür angelegt hat.
Hier ist die Rückwärtssortierung jedoch Mist. Denn der Besucher soll ja in chronologischer Reihenfolge die Bilder sehen.

Leider kann man nicht für jedes Album die Reihenfolge einstellen. Also muss es anders gelöst werden. Und dafür gibt es eine Hilfe des Herstellers. Die benutzerdefinierten Felder.
Diese findet man unter dem eigentlichen Editor und sie heißen „Benutzerdefinierte Felder“… logisch :)

Dort trägt man Stück für Stück die Sachen ein die man braucht. Hier erst einmal eine Liste mit den möglichen Einstellmöglichkeiten.

Für das Erscheinungsbild der Nextgen-Gallery stehen folgende Befehle zur Verfügung.

Feldbezeichnung mögliche Werte
ngg_gal_ShowOrder gallery : Zeigt zuerst die Gallerie
slide : Zeigt zuerst die Slideshow
ngg_gal_Images 0-xxx : (Nummer) Anzahl von Bildern pro Seite
ngg_gal_Sort “pid” : Sortiert die Vorschaubilder nach ID
“filename” : Sortiert die Vorschaubilder nach Dateiname
“alttext” : Sortiert die Vorschaubilder nach dem ALT oder TITEL Text
ngg_gal_SortDirection “ASC” : Aufsteigende Sortierung
“DESC” : Absteigende Sortierung
ngg_gal_ShowSlide 0 : (Off) Kein Slideshow Link
1 : (On) Zeigt Slideshow Link
ngg_gal_ImgageBrowser 0 : (Off) Zeigt die Bilder direkt
1 : (On) Zeigt den Bildbrowser

Und für das Erscheinungsbild der Nextgen-Slideshow die folgenden:

ngg_ir_Audio “url”: (URL) Spielt eine Musikdatei
ngg_ir_Overstretch none : Behält Original-Dimensionen
fit : Bilder unverhältnismäßig vergrößern
true : Bilder verhältnismäßig vergrößern
ngg_ir_Transition Setzt den Übergangseffekt zwischen den Bildern:
fade, bgfade, blocks, bubbles, circles, flash, fluids, lines, random, slowfade
ngg_ir_Backcolor 0xHXHXHX : (z.B. 000FFF)
Hintergrundfarbe der Steuerung, im HEX Format.
ngg_ir_Frontcolor 0xHXHXHX : (z.B. 000FFF)
Text und Button Farbe der Steuerung, im HEX Format.
ngg_ir_Lightcolor 0xHXHXHX : (z.B. 000FFF)
Überlappende Farbe der Steuerung, im HEX Format.
ngg_ir_Width 0-xxx : (Zahl) Breite der Slideshow
ngg_ir_Height 0-xxx : (Zahl) Höhe der Slideshow
ngg_ir_Rotatetime 0-xxx : (Zahl) Zeit die ein Bild stehen bleibt
ngg_ir_Shuffle 0 : (Off) Anzeige der Bilder in Reihenfolge
1 : (On) Zufälliges Bild anzeigen
ngg_ir_ShowNavigation 0 : (Off) Navigation deaktivieren
1 : (On) Navigation aktivieren
ngg_ir_ShowWatermark 0 : (Off) Kein Wasserzeichen (Logo)
1 : (On) Wasserzeichen (Logo) wird angezeigt
ngg_ir_Kenburns 0 : (Off) Ken burns Effekt aktivieren
1 : (On) Ken burns Effekt deaktivieren

In unserem Fall würden wir nun das benutzerdefinierte Feld „ngg_gal_SortDirection“ mit dem Wert „ASC“ anlegen. Und schon wäre das Album in diesem Post aufsteigend sortiert.

Man könnte auch mehrere Befehle miteinander kombinieren (mehrere benutzerdefinierte Felder ausfüllen). So wie man es braucht.

Ich hoffe das konnte euch (und mir) helfen. :)

Viele Grüße
Gordon

[PHP] NextGEN Gallery – Sortierung der Galerien

Hallo zusammen,

mal wieder die NextGEN Gallery.
Da ich es leid bin nun ständig alle Bilder per Hand zu bearbeiten und hochzuladen habe ich die Flash-Upload entdeckt… nachdem ich die Galerie schon Monate benutze. :-) Ein schickes Tool wenn man richtig viele Bilder hochladen möchte. Das funktioniert auch super! Nur einen kleinen Schönheitsfehler gibt es… die Sortierung.

Denn lade ich ein Bild einzeln hoch… dann landet es als erstes in der entsprechenden Galerie. Richtig, so soll es ja auch sein. Ist ja das neuste Bild also muss es als erstes angezeigt werden. Lade ein ganzes Verzeichnis per Flash Upload hoch dann bedeutet es (bei mir jedenfalls) das ich z.B. einen Tagesausflug dokumentiert habe… und dann möchte ich das dass erste geschossene Bild (also das eigentlich älteste) auch an erster Stelle haben.

Gut, der Programmierer kann das nicht voraus ahnen… aber er könnte z.B. für jede Galerie eine eigene Sortierungsoption angeben ;-)

Ich habe es für meine Zwecke (mal wieder) direkt im Quellcode geändert. Keine schöne Lösung, aber selten :-)

Wenn Du das auch so machen möchtest (vorsicht, beim nächsten Update ist alles wieder beim alten)… dann mache folgendes:

Rufe die Datei /wp-content/plugins/nggallery/nggfunctions.php mit einem Editor auf. Gehe in die Zeile 249 (ungefähr). Hier werden die Bilder sortiert:

$ngg_options[‚galSortDir‘] = ($ngg_options[‚galSortDir‘] == „DESC“) ? „DESC“ : „ASC“;

Ich habe es wie folgt gelöst. 2 verschiedene Alben. Eines mit Gallerien wo ich einzelne Bilder hochlade (aktuelle von mir oder so) und ein Album wo ich Galerien habe wo ich immer ganze Verzeichnisse hochlade. Du musst die ID’s der beiden Alben kennen. Hier nehme ich einfach 1 und 2 für das Beispiel.

Füge nun über der obigen Zeile den folgenden Code ein:

$album = get_query_var(‚album‘);

Damit haben wir nun die ID des aktuellen Albums. Jetzt müssen wir wissen welche Sortierung für welches Album. Album 1 ist letzte zuerst, also ASC. Bei Album 2 DESC.

if($album == 1) $ngg_options[‚galSortDir‘] = ($ngg_options[‚galSortDir‘] == „DESC“) ? „ASC“ : „DESC“;
else $ngg_options[‚galSortDir‘] = ($ngg_options[‚galSortDir‘] == „DESC“) ? „DESC“ : „ASC“;

Nun kann es sein das es jetzt genau falsch sortiert ist. Je nachdem wie Du die globale Sortierung eingestellt hast. Dann einfach entweder die globale Sortierung ändern oder $album == 1 gegen $album == 2 tauschen.

Das wars. Aber wie gesagt, wenn Du das nächste Update machst… ist wahrscheinlich alles wieder weg.

Gruss
Gordon

NextGEN Gallery – Bilder verkleinern im Seitenverhältnis

Soooo… nach langem verschieben habe ich mich heute mal beigemacht und das Problem mit dem Seitenverhältnis gelöst.

Das Problem ist folgendes… Gebe ich für meine Bilder einer Größe von 800 px x 600 px (Breite x Höhe) vor, so verkleinert die Software z.B. ein Bild von 1024px x 765px auf dieses Format. Ist mein Bild allerdings 765px x 1024px so wird es nicht auf 600px x 800px verkleinert sondern auf 450px x 600px. Und das ist nicht im Sinne des Erfinders. :)

Also habe ich mich heute mal hingesetzt und bin dem auf den Grund gegangen. Es ist eigentlich simpel. Das Bild wird hochgeladen und auf seine Größe kontrolliert. Die werte werden nach der Vorgabe neu berechnet und es wird aufgepasst das aus Querformat nicht plötzlich ein Hochformat wird und umgekehrt. Vergessen wurde aber leider auch Vorgabewerte anzupassen. Das tun wir nun…

Öffnen Sie die Datei „/wp-content/plugins/nextgen-gallery/admin/wp25/functions.php“ in einem Editor und suchen Sie nach der Function „function resizeImages()“. Hier finden Sie folgenes:

function resizeImages($gallery_absfolder, $pictures) {
// ** $gallery_absfolder must contain abspath !!

if(! class_exists(’ngg_Thumbnail‘))
require_once(NGGALLERY_ABSPATH.’/lib/thumbnail.inc.php‘);

$ngg_options = get_option(’ngg_options‘);

if (is_array($pictures)) {

$bar = new wpProgressBar(__(‚Running… Please wait‘,’nggallery‘));
$bar->setHeader(__(‚Resize images‘,’nggallery‘));
//total number of elements to process
$elements = count($pictures);
// wait a little bit after finished
if ($elements > 5) $bar->setSleepOnFinish(2);
//print the empty bar
$bar->initialize($elements);

foreach($pictures as $picture) {

if (!is_writable($gallery_absfolder.“/“.$picture)) {
$messagetext .= $gallery_absfolder.“/“.$picture.“<br />“;
$bar->increase();
continue;
}

$thumb = new ngg_Thumbnail($gallery_absfolder.“/“.$picture, TRUE);
// echo $thumb->errmsg;
// skip if file is not there
if (!$thumb->error) {
$thumb->resize($ngg_options[‚imgWidth‘],$ngg_options[‚imgHeight‘], $ngg_options[‚imgResampleMode‘]);
if ( $thumb->save($gallery_absfolder.“/“.$picture,$ngg_options[‚imgQuality‘]) ) {
// do not flush the buffer with useless messages
if ($elements < 100)
$bar->addNote($picture. __(‚ : Image resized…‘,’nggallery‘));
} else
$bar->addNote($picture . “ : Error : <strong>“.$thumb->errmsg.“</strong>“);
$bar->increase();
}
$thumb->destruct();
}
}

if(!empty($messagetext)) nggallery::show_error(‚<strong>‘.__(‚Some pictures are not writeable :‘,’nggallery‘).'</strong><br /><ul>‘.$messagetext.'</ul>‘);
return;
}

Das ist die Function die unseren „normalen“ Bildern eine neue Größe gibt. Wir ersetzen diese Funktion nun durch diese neu modifizierte:

function resizeImages($gallery_absfolder, $pictures) {
// ** $gallery_absfolder must contain abspath !!

if(! class_exists(’ngg_Thumbnail‘))
require_once(NGGALLERY_ABSPATH.’/lib/thumbnail.inc.php‘);

$ngg_options = get_option(’ngg_options‘);

if (is_array($pictures)) {

$bar = new wpProgressBar(__(‚Running… Please wait‘,’nggallery‘));
$bar->setHeader(__(‚Resize images‘,’nggallery‘));
//total number of elements to process
$elements = count($pictures);
// wait a little bit after finished
if ($elements > 5) $bar->setSleepOnFinish(2);
//print the empty bar
$bar->initialize($elements);

foreach($pictures as $picture) {

if (!is_writable($gallery_absfolder.“/“.$picture)) {
$messagetext .= $gallery_absfolder.“/“.$picture.“<br />“;
$bar->increase();
continue;
}

$thumb = new ngg_Thumbnail($gallery_absfolder.“/“.$picture, TRUE);
// echo $thumb->errmsg;
// skip if file is not there

if (!$thumb->error) {
//$thumb->resize($ngg_options[‚imgWidth‘], $ngg_options[‚imgHeight‘], $ngg_options[‚imgResampleMode‘]);

if ($thumb->currentDimensions[‚height‘] > $ngg_options[‚imgHeight‘] || $thumb->currentDimensions[‚width‘] > $ngg_options[‚imgWidth‘]) {

// check for portrait format
if ($thumb->currentDimensions[‚height‘] > $thumb->currentDimensions[‚width‘]) {
//vorgaben checken
if ($ngg_options[‚imgWidth‘] > $ngg_options[‚imgHeight‘]) {
$y = $ngg_options[‚imgWidth‘];
$x = $ngg_options[‚imgHeight‘];
} else {
$y = $ngg_options[‚imgHeight‘];
$x = $ngg_options[‚imgWidth‘];
}
$thumb->resize($x, 0, $ngg_options[‚imgResampleMode‘]);
// get optimal y startpos
$ypos = ($thumb->currentDimensions[‚height‘] – $y) / 2;
$thumb->crop(0, $ypos, $x,$y,$ngg_options[‚imgResampleMode‘]);
} else {
//vorgaben checken
if ($ngg_options[‚imgWidth‘] < $ngg_options[‚imgHeight‘]) {
$y = $ngg_options[‚imgWidth‘];
$x = $ngg_options[‚imgHeight‘];
} else {
$y = $ngg_options[‚imgHeight‘];
$x = $ngg_options[‚imgWidth‘];
}
$thumb->resize(0,$y,$ngg_options[‚imgResampleMode‘]);
// get optimal x startpos
$xpos = ($thumb->currentDimensions[‚width‘] – $x) / 2;
$thumb->crop($xpos, 0, $x,$y,$ngg_options[‚imgResampleMode‘]);
}

} else {
$thumb->resize($ngg_options[‚imgWidth‘], $ngg_options[‚imgHeight‘], $ngg_options[‚imgResampleMode‘]);
}

if ( $thumb->save($gallery_absfolder.“/“.$picture,$ngg_options[‚imgQuality‘]) ) {
// do not flush the buffer with useless messages
if ($elements < 100)
$bar->addNote($picture. __(‚ : Image resized…‘,’nggallery‘));
} else
$bar->addNote($picture . “ : Error : <strong>“.$thumb->errmsg.“</strong>“);
$bar->increase();
}
$thumb->destruct();
}
}

if(!empty($messagetext)) nggallery::show_error(‚<strong>‘.__(‚Some pictures are not writeable :‘,’nggallery‘).'</strong><br /><ul>‘.$messagetext.'</ul>‘);
return;
}

Was machen wir da nun im Einzelnen?

if ($thumb->currentDimensions[‚height‘] > $ngg_options[‚imgHeight‘] || $thumb->currentDimensions[‚width‘] > $ngg_options[‚imgWidth‘]) {

Hier überprüfen wir ob das Hochgeladene Bild überhaupt größer ist als die Vorgabe (hier 800px x 600px). Wenn nicht muss auch nichts verkleinert werden.

if ($thumb->currentDimensions[‚height‘] > $thumb->currentDimensions[‚width‘])

Hier überprüfen wir in welchem Seitenformat das Bild vorliegt, Quer- oder Hochformat.

if ($ngg_options[‚imgWidth‘] > $ngg_options[‚imgHeight‘]) {
$y = $ngg_options[‚imgWidth‘];
$x = $ngg_options[‚imgHeight‘];
} else {
$y = $ngg_options[‚imgHeight‘];
$x = $ngg_options[‚imgWidth‘];
}

Und das ist im Endeffekt das neue… Nachdem wir nun wissen ob wir es mit einem Quer- oder Hochformat zu tun haben, passen wir die Vorgabewerte dem Format an… 800px x 600px oder 600px x 800px (für mein Beispiel.

Und das war es auch schon. Sieht viel aus, ist aber mehr Erklärung als alles andere :)
Vielleicht ist das nicht das non-plus-ultra, aber es funktioniert. Und darauf kommt es an. Wer es besser machen kann… kann gern seinen Kommentar loswerden ;)

Bitte beachten Sie. Alle Angaben auf dieser Seite sind ohne Gewähr und nur auf eigene Gefahr zu verwenden!

Gruß
Gordon

Nextgen Gallery – Resizing images according to the aspect ratio

Soooo… after postponing it for quite a while… I sat down and solved finally the aspect ratio problem when Nextgen Gallery shall resize/shrink an image.

The problem is… If I set as picture size e.g. 800×600 px (width x height), then Nextgen Gallery resizes a picture from e.g. 1024x768px to this format. All good. But if the original picture is 768x1024px then the result is not a picture with 600x800px, no, it will be a picture of 450x600px. And that is not what we want. (Isn’t it?)

So, I sat down today and checked the sources. Actually its simple. The picture will be uploaded and checked on its size. The values will be re-calculated be the settings and the aspect ratio should be checked as well. They just forgot to adjust the settings. We’ll do that now…

Open the file „/wp-content/plugins/nextgen-gallery/admin/wp25/functions.php“ in an editor and search for the function „function resizeImages()“. Here you’ll see:

function resizeImages($gallery_absfolder, $pictures) {
// ** $gallery_absfolder must contain abspath !!

if(! class_exists(’ngg_Thumbnail‘))
require_once(NGGALLERY_ABSPATH.’/lib/thumbnail.inc.php‘);

$ngg_options = get_option(’ngg_options‘);

if (is_array($pictures)) {

$bar = new wpProgressBar(__(‚Running… Please wait‘,’nggallery‘));
$bar->setHeader(__(‚Resize images‘,’nggallery‘));
//total number of elements to process
$elements = count($pictures);
// wait a little bit after finished
if ($elements > 5) $bar->setSleepOnFinish(2);
//print the empty bar
$bar->initialize($elements);

foreach($pictures as $picture) {

if (!is_writable($gallery_absfolder.“/“.$picture)) {
$messagetext .= $gallery_absfolder.“/“.$picture.“<br />“;
$bar->increase();
continue;
}

$thumb = new ngg_Thumbnail($gallery_absfolder.“/“.$picture, TRUE);
// echo $thumb->errmsg;
// skip if file is not there
if (!$thumb->error) {
$thumb->resize($ngg_options[‚imgWidth‘],$ngg_options[‚imgHeight‘], $ngg_options[‚imgResampleMode‘]);
if ( $thumb->save($gallery_absfolder.“/“.$picture,$ngg_options[‚imgQuality‘]) ) {
// do not flush the buffer with useless messages
if ($elements < 100)
$bar->addNote($picture. __(‚ : Image resized…‘,’nggallery‘));
} else
$bar->addNote($picture . “ : Error : <strong>“.$thumb->errmsg.“</strong>“);
$bar->increase();
}
$thumb->destruct();
}
}

if(!empty($messagetext)) nggallery::show_error(‚<strong>‘.__(‚Some pictures are not writeable :‘,’nggallery‘).'</strong><br /><ul>‘.$messagetext.'</ul>‘);
return;
}

This is the function which resizes our original pictures. We’ll replace this function now with this modified one:

function resizeImages($gallery_absfolder, $pictures) {
// ** $gallery_absfolder must contain abspath !!

if(! class_exists(’ngg_Thumbnail‘))
require_once(NGGALLERY_ABSPATH.’/lib/thumbnail.inc.php‘);

$ngg_options = get_option(’ngg_options‘);

if (is_array($pictures)) {

$bar = new wpProgressBar(__(‚Running… Please wait‘,’nggallery‘));
$bar->setHeader(__(‚Resize images‘,’nggallery‘));
//total number of elements to process
$elements = count($pictures);
// wait a little bit after finished
if ($elements > 5) $bar->setSleepOnFinish(2);
//print the empty bar
$bar->initialize($elements);

foreach($pictures as $picture) {

if (!is_writable($gallery_absfolder.“/“.$picture)) {
$messagetext .= $gallery_absfolder.“/“.$picture.“<br />“;
$bar->increase();
continue;
}

$thumb = new ngg_Thumbnail($gallery_absfolder.“/“.$picture, TRUE);
// echo $thumb->errmsg;
// skip if file is not there

if (!$thumb->error) {
//$thumb->resize($ngg_options[‚imgWidth‘], $ngg_options[‚imgHeight‘], $ngg_options[‚imgResampleMode‘]);

if ($thumb->currentDimensions[‚height‘] > $ngg_options[‚imgHeight‘] || $thumb->currentDimensions[‚width‘] > $ngg_options[‚imgWidth‘]) {

// check for portrait format
if ($thumb->currentDimensions[‚height‘] > $thumb->currentDimensions[‚width‘]) {
//vorgaben checken
if ($ngg_options[‚imgWidth‘] > $ngg_options[‚imgHeight‘]) {
$y = $ngg_options[‚imgWidth‘];
$x = $ngg_options[‚imgHeight‘];
} else {
$y = $ngg_options[‚imgHeight‘];
$x = $ngg_options[‚imgWidth‘];
}
$thumb->resize($x, 0, $ngg_options[‚imgResampleMode‘]);
// get optimal y startpos
$ypos = ($thumb->currentDimensions[‚height‘] – $y) / 2;
$thumb->crop(0, $ypos, $x,$y,$ngg_options[‚imgResampleMode‘]);
} else {
//vorgaben checken
if ($ngg_options[‚imgWidth‘] < $ngg_options[‚imgHeight‘]) {
$y = $ngg_options[‚imgWidth‘];
$x = $ngg_options[‚imgHeight‘];
} else {
$y = $ngg_options[‚imgHeight‘];
$x = $ngg_options[‚imgWidth‘];
}
$thumb->resize(0,$y,$ngg_options[‚imgResampleMode‘]);
// get optimal x startpos
$xpos = ($thumb->currentDimensions[‚width‘] – $x) / 2;
$thumb->crop($xpos, 0, $x,$y,$ngg_options[‚imgResampleMode‘]);
}

} else {
$thumb->resize($ngg_options[‚imgWidth‘], $ngg_options[‚imgHeight‘], $ngg_options[‚imgResampleMode‘]);
}

if ( $thumb->save($gallery_absfolder.“/“.$picture,$ngg_options[‚imgQuality‘]) ) {
// do not flush the buffer with useless messages
if ($elements < 100)
$bar->addNote($picture. __(‚ : Image resized…‘,’nggallery‘));
} else
$bar->addNote($picture . “ : Error : <strong>“.$thumb->errmsg.“</strong>“);
$bar->increase();
}
$thumb->destruct();
}
}

if(!empty($messagetext)) nggallery::show_error(‚<strong>‘.__(‚Some pictures are not writeable :‘,’nggallery‘).'</strong><br /><ul>‘.$messagetext.'</ul>‘);
return;
}

Ok, what is this doing now?

if ($thumb->currentDimensions[‚height‘] > $ngg_options[‚imgHeight‘] || $thumb->currentDimensions[‚width‘] > $ngg_options[‚imgWidth‘]) {

First of all we check if the uploaded image is bigger then the settings. If not, then we don’t need to do anything anyway.

if ($thumb->currentDimensions[‚height‘] > $thumb->currentDimensions[‚width‘])

Here we check the aspect ratio… horizontal or vertical format.

if ($ngg_options[‚imgWidth‘] > $ngg_options[‚imgHeight‘]) {
$y = $ngg_options[‚imgWidth‘];
$x = $ngg_options[‚imgHeight‘];
} else {
$y = $ngg_options[‚imgHeight‘];
$x = $ngg_options[‚imgWidth‘];
}

And that is basically the new thing… after we know if we have a horizontal or vertical picture, we can adjust the setting values… like 800x600px or 600x800px (for my example).

And thats it already. Looks a lot, but its more explaining then anything else :)
Maybe that is not the best solution (especially it is not ‚update save‘), but it works for now. If you know a better solution, then let me have it in the comments. ;)

Please notice that all code snippets and examples on this page are on your own risk. I am not responsible for anything you do!

Cheers
Gordon

Image resize problem with the NextGEN Gallery plugin

Hi,

and I had a problem again. If you use WordPress with the „NextGEN Gallery“ plugin, then you may also stumble over this problem after some time.
In the options of the plugin you can set a picture size to shrink the pictures, in case they are to big.
I’ve added there the value of 640 x 480 px. Because to big pictures need too long to load and use unnecessarily much disk space. A few minutes ago I was wondering why the pictures still need ages to load and in the full screen mode I saw it … the pictures haven’t been resized by the plugin.

After a while consulting Google I found help.

Edit the file „/wp-content/plugins/nextgen-gallery/admin/wp25/functions.php“ and search the function „function upload_images()„. Scroll to the end of this function and search for:

//create thumbnails
nggAdmin::generatethumbnail(WINABSPATH.$gallerypath,$imageslist);

Write before this:

//create resized pictures
nggAdmin::resizeImages(WINABSPATH.$gallerypath,$imageslist);

Save it, upload the file to the web-space again and then it should work.

Source: http://wordpress.org/support/topic/177782

But something is still disturbing me. Wenn I set as size 640 x 480px then is it horizontal format. But the function doesn’t automatically recognize vertical format. I mean it recognize it of course… but the height is still 480px and the width will be calculated by the height. Like this the resulting image is a bit small then. Would be nice if the function would change the values according to the format of the picture.
Maybe I will check it next week. Then I’ll have more time. :)

[UPDATE] The article is ready, the problem is solved: To the article

Cheers
Gordon

NextGEN Gallery und Bilder verkleinern…

Hallo,

da hatte ich doch gerade mal wieder ein Problem. Wer WordPress mit dem Plugin „NextGEN Gallery“ verwendet wird vielleicht auch drauf stoßen.
Man kann in den Optionen angeben auf welche Bildgröße die Bilder verkleinert werden sollen (falls Sie zu groß sind).
Ich habe dort 640px x 480px angegeben. Denn zu große Bilder brauchen zu lange zum Laden und benötigen nur unnötig Speicherplatz. Nun habe ich mich vorhin gewundert warum die Bilder dennoch so lange zum Laden brauchen und bei einer Vollbildansicht hab ichs dann gesehen… die Bilder wurden nicht verkleinert.

Nach einigem Googlen habe ich dann eine Hilfe gefunden. Allerdings auf englisch… daher gebe ich es einfach mal hier auf deutsch wieder:

Bearbeiten Sie die Datei „/wp-content/plugins/nextgen-gallery/admin/wp25/functions.php“ und suchen Sie nach der Funktion „function upload_images()„. Scollen Sie ganz an das ende der Funktion und suchen Sie nach:

//create thumbnails
nggAdmin::generatethumbnail(WINABSPATH.$gallerypath,$imageslist);

Davor schreiben Sie dann folgendes:

//create resized pictures
nggAdmin::resizeImages(WINABSPATH.$gallerypath,$imageslist);

Speichern (und die Datei wieder auf den Webspace laden) und nun sollte es funktionieren.

Quelle: http://wordpress.org/support/topic/177782

Etwas stört mich nun aber immernoch. Wenn ich als größe 640px x 480px angebe ist das ja das Querformat. Er erkennt allerdings nicht automatisch ein Hochformat. Also er erkennt es schon… nimmt aber weiter fleißig 480px als höhe an und rechnet die Breite um. Damit wird das Bild aber noch kleiner als gedacht. Schöner wäre es wenn er im Querformat dann einfach 480px x 640px benutzt.
Vielleicht werde ich mich da nächste Woche mal ransetzen. Da habe ich dann ja wieder Zeit :)
[UPDATE] Der Artikel ist fertig, das Problem gelöst: Zum Artikel

Gruß
Gordon