Saves (uploads) pictures to server.

@return mixed
966470
public function save()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        if ($myConfig->isDemoShop()) {
            // disabling uploading pictures if this is demo shop
            $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
            $oEx->setMessage('ARTICLE_PICTURES_UPLOADISDISABLED');
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false);

            return;
        }

        parent::save();

        $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
        if ($oArticle->load($this->getEditObjectId())) {
            $oArticle->assign(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval"));
            \OxidEsales\Eshop\Core\Registry::getUtilsFile()->processFiles($oArticle);

            // Show that no new image added
            if (\OxidEsales\Eshop\Core\Registry::getUtilsFile()->getNewFilesCounter() == 0) {
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
                $oEx->setMessage('NO_PICTURES_CHANGES');
                \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false);
            }

            $oArticle->save();
        }
    }
1128635
private function _save()
    {
        $this->file->open($this->tmpfile);
        $this->_parse();
        if (!$this->file->addFromString('content.xml', $this->contentXml) || !$this->file->addFromString('styles.xml', $this->stylesXml)) {
            throw new OdfException('Error during file export addFromString');
        }
        $lastpos=strrpos($this->manifestXml, "\n", -15); //find second last newline in the manifest.xml file
        $manifdata = "";

        //Enter all images description in $manifdata variable
        foreach ($this->manif_vars as $val) {
            $ext = substr(strrchr($val, '.'), 1);
            $manifdata = $manifdata.'<manifest:file-entry manifest:media-type="image/'.$ext.'" manifest:full-path="Pictures/'.$val.'"/>'."\n";
        }
        //Place content of $manifdata variable in manifest.xml file at appropriate place
        $this->manifestXml = substr_replace($this->manifestXml, "\n".$manifdata, $lastpos+1, 0);
        //$this->manifestXml = $this->manifestXml ."\n".$manifdata;

        if (! $this->file->addFromString('META-INF/manifest.xml', $this->manifestXml)) {
            throw new OdfException('Error during manifest file export');
        }
        foreach ($this->images as $imageKey => $imageValue) {
            $this->file->addFile($imageKey, 'Pictures/' . $imageValue);
        }
        $this->file->close(); // seems to bug on windows CLI sometimes
    }
439467
public function store(UploadImageRequest $request)
    {
        $upload = $this->uploader->upload($request->file('image'), storage_path('app/laramanager/images'));

        return $this->imageRepository->create($upload->toArray());
    }
784830
public function save()
    {
        $keys = array_keys($this->langstrings);
        sort($keys);

        $maxlen       = 0;
        $langPrefixes = array();
        foreach ($keys as $key) {
            $tokens = explode('.', $key);
            if (preg_match('/tl_layout\.[a-z]+\.css\./', $key)) {
                $tokens = array($tokens[0], $tokens[1] . '.' . $tokens[2], $tokens[3]);
            }
            $langPrefix = '$GLOBALS[\'TL_LANG\']';
            foreach ($tokens as $token) {
                $langPrefix .= '[\'' . $token . '\']';
            }

            $langPrefixes[$key] = $langPrefix;

            if (strlen($langPrefix) > $maxlen) {
                $maxlen = strlen($langPrefix);
            }
        }

        $buffer = $this->getHead() . PHP_EOL . PHP_EOL;
        foreach ($keys as $key) {
            $prefix  = $langPrefixes[$key];
            $buffer .= sprintf(
                '%s = %s;' . PHP_EOL,
                $prefix . str_repeat(' ', ($maxlen - strlen($prefix))),
                var_export($this->getValue($key), true)
            );
        }
        $buffer  .= PHP_EOL;
        $resource = fopen($this->filename, 'wb');
        fputs($resource, $buffer);

        fclose($resource);
    }
351275
public function save()
    {
        $this->triggerEvent('onBeforeSave');

        $result = $this->getFlexDirectory()->getStorage()->replaceRows([$this->getStorageKey() => $this->prepareStorage()]);

        $value = reset($result);
        $storageKey = key($result);
        if ($value && $storageKey) {
            $this->setStorageKey($storageKey);
            if (!$this->hasKey()) {
                $this->setKey($storageKey);
            }
        }

        if (method_exists($this, 'saveUpdatedMedia')) {
            $this->saveUpdatedMedia();
        }

        try {
            $this->getFlexDirectory()->clearCache();
            if (method_exists($this, 'clearMediaCache')) {
                $this->clearMediaCache();
            }
        } catch (InvalidArgumentException $e) {
            /** @var Debugger $debugger */
            $debugger = Grav::instance()['debugger'];
            $debugger->addException($e);

            // Caching failed, but we can ignore that for now.
        }

        $this->triggerEvent('onAfterSave');

        return $this;
    }
85035
public function upload()
    {
        $album = $this->request->getQuery('album');
        $albums = $this->viewVars['albums']->toArray();

        //If there's only one available album
        if (!$album && count($albums) < 2) {
            $album = array_key_first($albums);
            $this->request = $this->request->withQueryParams(compact('album'));
        }

        if ($this->request->getData('file')) {
            is_true_or_fail($album, __d('me_cms', 'Missing ID'), InternalErrorException::class);

            $uploaded = $this->Uploader->set($this->request->getData('file'))
                ->mimetype('image')
                ->save(PHOTOS . $album);

            if (!$uploaded) {
                return $this->setUploadError($this->Uploader->getError());
            }

            $entity = $this->Photos->newEntity([
                'album_id' => $album,
                'filename' => basename($uploaded),
            ]);

            if ($entity->getErrors()) {
                return $this->setUploadError(array_value_first_recursive($entity->getErrors()));
            }

            if (!$this->Photos->save($entity)) {
                $this->setUploadError(I18N_OPERATION_NOT_OK);
            }
        }
    }
40511
public function save()
	{
		if ( ! $this->is_loaded() ) return false;

		$this->fill_defaults();

		$error = null;

		$id = wp_insert_post( $this->attributes, $error );

		if ( ! empty( $id ) ) {

			$this->attributes['ID'] = $id;

			$this->save_meta_all();

		}

		return $error === false ? true : $error;
	}
1238560
public function save() {
		if (!isset($this->new_album)) {
			$this->new_album = 1;
		}

		if (!isset($this->last_notified)) {
			$this->last_notified = 0;
		}

		if (!parent::save()) {
			return false;
		}

		mkdir(tp_get_img_dir($this->guid), 0755, true);

		return true;
	}
934979
public function save($data = null) {
		if (!parent::save()) {
			return false;
		}

		if ($data) {
			// new image
			$this->simpletype = 'image';
			$this->saveImageFile($data);
			$this->saveThumbnails();
			$this->extractExifData();
		}

		return true;
	}
670188
public function save()
	{
		if(!is_dir($this->path))
		{
			mkdir($this->path, 0777, true);
		}
		$fileName = date('Y-m-d');
		$fileURI = $this->path . $fileName . $this->ext;
		$i = 1;
		while(is_file($fileURI) && filesize($fileURI) > $this->maxSize)
		{
			$fileURI = "{$this->path}{$fileName}-{$i}{$this->ext}";
			++$i;
		}
		$content = '';
		foreach($this->data as $item)
		{
			$content .= "[{$item['time']}] {$item['content']}\r\n";
		}
		if('' !== $content)
		{
			return error_log($content, 3, $fileURI);
		}
		else
		{
			return true;
		}
	}
1303452
protected function save()
    {
        $filename = Path::create([$this->outputPath(), $this->outputFile()]);

        return (bool) \file_put_contents($filename->toString(), $this->stub);
    }
443731
public function imageChangeByUpload()
    {
        $formName = $this->owner->formName();
        if (!empty($_POST[$formName][$this->imageAttribute]) && $_POST[$formName][$this->imageAttribute] == 'empty') {
            // reset image
            $this->imageReset();
        } else {
            // upload new
            if (!empty($_FILES[$formName]['tmp_name'][$this->imageAttribute])) {
                $this->imageChange(
                    [$_FILES[$formName]['name'][$this->imageAttribute] => $_FILES[$formName]['tmp_name'][$this->imageAttribute]]
                );
            }
        }
    }
1011833
public function save()
    {
        $blSaved = parent::save();
        if ($blSaved && $this->oxcontents__oxloadid->value === 'oxagb') {
            $sShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
            $sVersion = $this->oxcontents__oxtermversion->value;

            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            // dropping expired..
            $oDb->execute("delete from oxacceptedterms where oxshopid='{$sShopId}' and oxtermversion != " . $oDb->quote($sVersion));
        }

        return $blSaved;
    }
1024731
public function afterSave()
    {
        if (!$this->files) {
            return true;
        }
        $oldFileCount = $this->getFileCount();
        /**
         * @var UploadedFile $file
         */
        foreach ($this->files as $key => $file) {
            $this->fileNumber = $oldFileCount + $key + 1;
            $this->fileName = $this->fileNumber . '_' . $file->name;
            if ($this->fileNumber == 1) {
                $this->owner->updateAttributes([$this->fileField => $this->fileName]);
            }
            $path = $this->getFilePath(null, $this->fileName);
            $this->createFilePath($path);
            $file->saveAs($path);
            foreach ($this->imageSettings as $name => $options) {
                $this->processImage($name, $options);
            }    
        }
    }
531871
public function uploadAction ()
    {
        $handle = $this->getRequest()->files->get('file');
        
        if ($handle && $handle->getError()){
            return new JsonResponse(array(
                'success' => false,
                'err_msg' => $this->container->get('translator')
                    ->trans('file_upload_http_error', array(), 'ThraceMediaBundle')
            ));
        }

        $imageManager = $this->container->get('thrace_media.imagemanager');
        $options = $this->container->getParameter('thrace_media.plupload.options');
        $extension = $handle->getClientOriginalExtension();
        $name = uniqid() . '.' . $extension;
        
        if(!$extension){
            return new JsonResponse(array(
                'success' => false,
                'err_msg' => sprintf('Unknown Mime Type: "%s"', $handle->getMimeType())
            ));
        }

        $validate = $this->validateImage($handle);

        if ($validate !== true) {
            return new JsonResponse(array(
                'success' => false,
                'err_msg' => $validate
            ));
        }

        $content = $imageManager->normalizeImage(
            $name, file_get_contents($handle->getRealPath()), 
            $options['normalize_width'], $options['normalize_height']
        );
        
        $imageManager->saveToTemporaryDirectory($name, $content);
        $imageManager->makeImageCopyToOriginalDirectory($name);
        $hash = $imageManager->checksumTemporaryFileByName($name);

        return new JsonResponse(array(
            'success' => true,
            'name'    => $name,
            'hash'    => $hash
        ));
    }
870571
public function save()
    {
        $this->cache = array();
        $date         = $this->http->getDate(time());
        $maxAge       = $this->http->getMaxAge($this->defaultMaxAge);
        $lastModified = $this->http->getLastModified();
        $type         = $this->http->getContentType();

        $this->cache['Date']           = gmdate("D, d M Y H:i:s T", $date);
        $this->cache['Max-Age']        = $maxAge;
        $this->cache['Content-Type']   = $type;
        $this->cache['Url']            = $this->url;

        if ($lastModified) {
            $this->cache['Last-Modified'] = gmdate("D, d M Y H:i:s T", $lastModified);
        }

        // Save only if body is a valid image
        $body = $this->http->getBody();
        $img = imagecreatefromstring($body);

        if ($img !== false) {
            file_put_contents($this->fileName, $body);
            file_put_contents($this->fileJson, json_encode($this->cache));
            return $this->fileName;
        }

        return false;
    }
86266
public function save()
    {
        $input              = Input::all();
        $session            = app('request')->session();
        $classname          = array_get($input, 'classname');
        $key                = uri();
        $params             = $session->get($key);
        $params[$classname] = array_get($input, 'params');
        $session->put($key, $params);
        $session->save();
        return response(app($classname)->sidebar($params[$classname]), 200);
    }