Skip to content

Instantly share code, notes, and snippets.

@putzflorian
Created July 23, 2014 08:57
Show Gist options
  • Select an option

  • Save putzflorian/f6fc71f4a04a2c68b54c to your computer and use it in GitHub Desktop.

Select an option

Save putzflorian/f6fc71f4a04a2c68b54c to your computer and use it in GitHub Desktop.
Pimcore_Image Create temp Images
<?php
$tmpFiles = [];
foreach ($_FILES as $file) {
$imPath = PIMCORE_TEMPORARY_DIRECTORY . "/" . uniqid() . ".jpg";
$im = Pimcore_Image::getInstance();
$im->load($file["tmp_name"]);
// $im->load("http://asdsadasd/test.jpg");
$im->scaleByWidth(1000);
$im->save($imPath, "JPEG", 80);
$tmpFiles[] = $imPath;
}
// senden
foreach($tmpFiles as $i) {
unlink($i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment