Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

gibt es in PHP die Möglichkeit GIF, PNG usw. nach JPEG umzuwandeln und Thumbnails zu erzeugen?

PHP bietet verschiedene Funktionen aus der GD-Lib um Bilder zu modifzieren / zu erstellen.

Mehr dazu findest du in der Doku: http://de.php.net/gd

wobei man meines wissens für gif eine ältere gd braucht, da der gif-support aus lizenzgründen rausgenommen wurde.

Ich kann aber nicht davon ausgehen, dass das auf dem Webserver installiert ist.
Ist das eine Frage oder eine Feststellung?

Du wirst nicht drumrumkommen eine externe Library mit einzubinden, die dir die gewünschten Funktionalitäten bereitstellt. Ob das nun direkt in PHP geschieht oder über den Hack Systemprogramm aufrufen geschieht ist dabei gar nicht mal so wichtig - aber einbinden wirst du es müssen.

So erstelle ich zum Beispiel Thumbnails:


// Methode meiner Klasse

function createThumb() {
$bildData = getimagesize($this->bild);
$ret = false;
$image = null;
$orig = null;

// Orginal laden
switch($bildData[2]) {
case _GIF: $orig = imagecreatefromgif($this->bild);
break;
case _JPEG: $orig = imagecreatefromjpeg($this->bild);
break;
case _PNG: $orig = imagecreatefrompng($this->bild);
break;
default: return false;
}

$hoehe = $bildData[1];
$breite = $bildData[0];
if ($breite > $hoehe) { // Querformat
$xSize = TG_MAX_X;
$ySize = intval($hoehe * $xSize / $breite);
}
else { // Hochformat
$ySize = TG_MAX_X;
$xSize = intval($breite * $ySize / $hoehe);
}
// Resize done

$image = imagecreatetruecolor($xSize, $ySize);
$imageCreated = imagecopyresampled($image, $orig, 0, 0, 0, 0, $xSize, $ySize, $bildData[0], $bildData[1]);
if ($orig !== null) imagedestroy($orig);
// Thumbnail speichern
if ($image !== null && $image != "") {
$name = basename($this->bild);
$pos = strrpos($name, ".");
$name = substr($name, 0, $pos);
$this->thumb = $this->thumbDir."/".$name;
if (imagetypes() & IMG_JPEG) {
$this->thumb .= ".jpg";
$ret = imagejpeg($image, $this->thumb);
}
else if (imagetypes() & IMG_PNG) {
$this->thumb .= ".png";
$ret = imagepng($image, $this->thumb);
}
else if (imagetypes() & IMG_PNG) {
$this->thumb .= ".gif";
$ret = imagejpeg($image, $this->thumb);
}

if ($image != null) imagedestroy($image);
}

return $ret;
}
[/PHP]

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.