Jump to content
Robert1995

How To Aurigma Express in Zend & other Frameworks

Recommended Posts

Posted

Ma uitam prin notepadurile cu bucati de cod care nu as vrea sa le pierd niciodata si am gasit asta. Cum sa integrezi in Zend Aurigma Express.

Am incercat si in codeigniter si acolo cu putine schimbari merge . Asta e versiunea Zend pentru ca pe asta mi-am frecat nervi :)

Eh Who knows maybe it can help you :).

Controllers :


public function addImageAction(){
$config = Zend_Registry::get('config');
$this->view->java_url = $config['url']['base']."Aurigma/ImageUploaderPHP/Scripts/ImageUploader7.jar";
$product_id = $this->_getParam('prod');
$this->view->target = $product_id;
$this->view->prod = $product_id;
}

function onFileUploaded($uploadedFile) {
$absGalleryPath = realpath($this->_path) . DIRECTORY_SEPARATOR;
$originalFileName = $uploadedFile->getSourceName();
// Save source file
$convertedFiles = $uploadedFile->getConvertedFiles();
$thumbnail1 = $convertedFiles[0];
$thumbnail1->moveTo($absGalleryPath . $originalFileName);
$thumbnail2 = $convertedFiles[1];
$thumbnail2->moveTo($absGalleryPath . $originalFileName."_Thumbnail1.jpg");
exit();
}

public function uploadImagesAction(){
$this->_helper->layout->disableLayout();
$this->getHelper('viewRenderer')->setNoRender();

$this->_session->message = $this->_session->messages['message_backend_product_image_notification_succesfully_added'];
require_once ROOT_PATH . "/Aurigma/ImageUploaderPHP/UploadHandler.class.php";
require_once ROOT_PATH . "/Aurigma/ImageUploaderPHP/UploadedFile.class.php";

$product_id = $this->_getParam('prod');
$product = Model_Product::getById($product_id);
$this->_path = "images/products/".$product['id']."/";
$uploadHandler = new UploadHandler();
$uploadHandler->setFileUploadedCallback(array($this, 'onFileUploaded'));
// Bucata asta de cod trebuie scrisa asa in cazul unui framework..
$uploadHandler->processRequest();

exit();
}

Views :

add-image


<?php
require_once 'Aurigma/ImageUploaderPHP/Uploader.class.php';
require_once 'Aurigma/ImageUploaderPHP/InstallationProgress.class.php';
// Create Image Uploader
$uploader = new Uploader('Uploader1');
$uploader->getJavaControl()->setCodeBase($this->java_url);
$uploader->setHeight('500px');
$uploader->setWidth('100%');
$uploader->setLicenseKey('XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXXX');

$uploader->setEnableDescriptionEditor(FALSE);
$uploader->setEnableRotation(FALSE);

$base = $this->config['url']['base'];
$uploader->getUploadSettings()->setActionUrl($base."admin/product/upload-images/prod/".$this->prod);
$uploader->getUploadSettings()->setRedirectUrl($base."admin/product/view/prod/".$this->prod);

$uploader->getUploadSettings()->setFilesPerPackage(1);

$converters = &$uploader->getConverters();
$converter = new Converter();
$converter->setMode("*.*=Thumbnail");
$converter->setThumbnailFitMode("Fit");
$converter->setThumbnailWidth(800);
$converter->setThumbnailHeight(800);
$converters[] = $converter;
$converter = new Converter();
$converter->setMode("*.*=Thumbnail");
$converter->setThumbnailFitMode("Fit");
$converter->setThumbnailWidth(100);
$converter->setThumbnailHeight(100);
$converters[] = $converter;

$uploader->getFolderPane()->setHeight(370);
$uploader->getUploadPane()->setViewMode('List');
$uploader->getDetailsViewColumns()->setInfoText('');
$uploader->getPaneItem()->setShowFileNameInThumbnailsView(TRUE);

$ip = new InstallationProgress($uploader);
$ip->setProgressImageUrl('images/installation_progress.gif');
$ip->setProgressCssClass('ip-progress');
$ip->setInstructionsCssClass('ip-instructions');

$uploader->render();
?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...