Backend

ID #1

Bildgröße verändern / Probleme beim Heraufladen von Dateien

In der Dateizentrale: Die max. Thumbnail-Größe eines heraufgeladenen Bildes korrespondiert mit den Einstellungen in der conf.inc.php z.Bsp. 100 x 100px
$phpwcms["img_list_width"]    = 100;  //max with of the list thumbnail image 
$phpwcms["img_list_height"]   = 100;  //max height of the list thumbnail image

Die max. Vorschaubild-Größe in der Dateizentrale ist fest programmiert auf 538 x 538px

Jetzt kommen wir zu einem Artikel mit einem großen Bild.
------------------------------------------------------------------------

Wir benutzen den Contentpart Text mit bild oder Bilder.
Der Bildbrowser zeigt uns Thumbnails mit der voreingestellten Größe aus der conf.inc.php z.Bsp. max.100 x 100px.
Die max. Breite: und max. Höhe: korrespondieren mit den Einstellungen in der conf.inc.php

$phpwcms["content_width"]  = 700; //max width of the article content column  -
important for rendering multi column images

In diesem Fall kann das Bildes maximal 700px breit werden.
Haben Sie ein Layout mit einer Gesamtbreite von  765px - 200px für die Navigation  - 30px für den Rand, dann wird das Layout außeinandergedrückt. Aber Sie haben die Möglichkeit die Briete des Bildes auf  535px zu begrenzen. Im frontend sieht der Betrachterdas Bild in einer Breite von 565px. Es passt.
Haben Sie die Option "Klick vergrößerbar" aktiviert, wird das Bils in einem  pop up Fenster in Originalgröße geöffnet. 
Die Voraussetzungen dazu ist das richtige Einstellung in der conf.inc.php

$phpwcms["img_prev_width"]    = 1000; //max width of the large preview image
$phpwcms["img_prev_height"]   = 900; //max height of the large preview image

Z.Bsp. max.  Breite/Höhe von 1000 / 900px ist die maximale Größe des Bildes im pop up Fenster. Möchten Sie größere Bilder verwenden, muss die conf.inc.php angepasst werden.
------------------------------------------------------------------------
Sie können kein großes Bild /Datei hochladen.
Nach dem Heraufladen eines großen bildes/Datei sehen Sie kein Thumbnail oder ein Laufzeitfehler wird generiert.
1. Das Bild ist korrupt.  
2. Die Einstellungen in der conf.inc.php sind zu klein.

$phpwcms["file_maxsize"]  = 2097152; //Bytes (50 x 1024 x 1024) 

Aber das wird wahrscheinlich nicht der einzige Grund für das Problem sein.
Bitte überprüfen Sie die Server-Einstellungen mit dem Menüpunkt phpinfo(). Dort gibt es einige Werte, die das Hochladen von Dateien beeinflussen:
---------------------
max_execution_time
memory_limit
post_max_size
upload_max_filesize

---------------------
Bitte denken Sie immer daran, das eine Bildoperation mit GD/ImageMagick immmer wesentlich mehr Arbeitsspeicher braucht (overhead) als die eigentliche Größe des Bildes.
Zitat www.radinks.com
----------------------------------------------------------------------------------
Howto optimize your PHP installation to handle large file uploads.

Though PHP presents a very versatile and user friendly interface for handling file uploads, the default installation is not geared for working with files in excess of 2 Mega Bytes. This article will help you configure your PHP engine for handling such large file transfers.

The php.ini File
All the configuration settings for your installation are contained in the php.ini file. Sometimes these setting might be overridden by directives in apache .htaccess files or even with in the scripts themselves. However you cannot over ride the settings that effect file uploads with .htaccess directives in this way. So let's just concentrate on the ini file.

You can call the phpinfo() function to find the location of your php.ini file, it will also tell you the current values for the following settings that we need to modify

  • file_uploads
  • upload_max_filesize
  • max_input_time
  • memory_limit
  • max_execution_time
  • post_max_size

The first one is fairly obvious if you set this off, uploading is disabled for your installation. We will cover the rest of the configuration settings in detail below.

upload_max_filesize and post_max_sizeFiles are usually POSTed to the webserver in a format known as 'multipart/form-data'. The post_max_size sets the upper limit on the amount of data that a script can accept in this manner. Ideally this value should be larger than the value that you set for upload_max_filesize.
It's important to realize that upload_max_filesize is the sum of the sizes of all the files that you are uploading. post_max_size is the upload_max_filesize plus the sum of the lengths of all the other fields in the form plus any mime headers that the encoder might include. Since these fields are typically small you can often approximate the upload max size to the post max size.
According to the PHP documentation you can set a MAX_UPLOAD_LIMIT in your HTML form to suggest a limit to the browser. Our understanding is that browsers totally ignore this directive.  

memory_limit
When the PHP engine is handling an incoming POST it needs to keep some of the incoming data in memory. This directive has any effect only if you have used the --enable-memory-limit option at configuration time. Setting too high a value can be very dangerous because if several uploads are being handled concurrently all available memory will be used up and other unrelated scripts that consume a lot of memory might effect the whole server as well.

max_execution_time and max_input_timeThese settings define the maximum life time of the script and the time that the script should spend in accepting input. If several mega bytes of data are being transfered max_input_time should be reasonably high. You can override the setting in the ini file for max_input_time by calling the set_time_limit() function in your scripts.

Additonal Comments
- Apache Settings
The apache webserver has a LimitRequestBody configuration directive that restricts the size of all POST data regardless of the web scripting language in use. Some RPM installations sets limit request body to 512Kb. You will need to change this to a larger value or remove the entry altogether.

Other OptionsIf you expect to handle a large number of concurrent file transfers on your website consider using a perl or java server side component. PHP happens to be our favourite web programming language as well but perl and Java are just slightly ahead when it comes to file upload.

Most installations of perl as an apache module can accept in excess of 32 megabytes out of the box. Compare this against the 2MB default for PHP. The downside is that perl coding takes just a bit more effort than PHP but it's worth it.
----------------------------------------------------------------------------------

Wenn Sie keine Möglichkeit haben die php.ini einzustellen, müssen sie entweder die Bilder/Dateien verkleinern oder den Provider bzw. Tarf wechseln.
Um die php.ini einzustellen brauchen Sie einen shell-Zugriff und das ist i.d.R. nur bei dedizierten Servern möglich.

Tags: -

Verwandte Artikel:

Letzte Änderung des Artikels: 2006-04-01 10:20
Autor: flip-flop / DeXXus / jscholtysik
Revision: 1.2

Sprache ändern
 

Digg it! Share on Facebook Artikel ausdrucken Artikel weiterempfehlen Als PDF-Datei anzeigen
Übersetzungsvorschlag für Übersetzungsvorschlag für
Bewertung der Nützlichkeit dieses Artikels:

Durchschnittliche Bewertung: 5 (1 Abstimung)

vollkommen überflüssig 1 2 3 4 5 sehr wertvoll

Es ist möglich, diesen Artikel zu kommentieren.