OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



test upload file image createIssue

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

test upload file image createIssue

Postby cristianviza » Fri Aug 23, 2013 1:42 pm

Hello community.
how are everybody? I need a advice :) .
I modify the file /templates/editor/issues/createIssue.tpl , to read that you can only up .png file
Image
also modify
/classes/issue/form/IssueForm.inc.php
/lib/pkp/classes/file/FileManager.inc.php -> getImageExtension2($type))
but I would you like also limit size of image upload (width,heigth) pixels , i try use list($width, $heigth, $tipo, $atributos) = getimagesize($ss) however $width return emtpy, I though because $ss is incorrect.
That variable records the patch to plain, unformatted you select? or in what way do I recommend that desire control.
Regards
Code: Select all
   if ($publicFileManager->uploadedFileExists('coverPage')) {
         $type = $publicFileManager->getUploadedFileType('coverPage');

         if (!$publicFileManager->getImageExtension2($type)) {
            $this->addError('coverPage', __('editor.issues.invalidCoverPageFormat'));
            $this->addErrorField('coverPage');
         }
         
         //control size
      $FilePath=$publicFileManager->getUploadedFilePath('coverPage');
         $FileName=$publicFileManager->getUploadedFileName('coverPage');
         $ss="img/".$FileName;
                                         //try getimagesize
      list($width, $heigth, $tipo, $atr) = getimagesize($ss);
      
                      if ($width<100) {
                      $this->addError('coverPage',"the width is < 100px, please upload other imagen");
            //$this->addError('coverPage', __('editor.issues.invalidCoverPageFormat'));
            //$this->addErrorField('coverPage');
         }
      }
cristianviza
 
Posts: 75
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina

Re: test upload file image createIssue

Postby asmecher » Mon Aug 26, 2013 3:17 pm

Hi Cristian,

Off the top of my head, I think the "img/" prefix is wrong -- try removing it?

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Re: test upload file image createIssue

Postby cristianviza » Wed Aug 28, 2013 1:59 pm

Thanks for you response. You are right asmecher.

Regards Cristian
cristianviza
 
Posts: 75
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron