0

Hi evrybody,

i created fileuploader,user upload photos,the photos arranded in random size.
i need display photos three random size
first image automatically getin width:140,second:190,thrid:240.
more than 10 images user uplaod.
next image getin size 1;
all the images display overlap.

This is my fileuplaod code.

public function executeUpload(sfWebRequest $request)
  {
    $meetnewpeople_id = $request->getParameter('meetnewpeopleid');
    $file_name = $request->getParameter('qqfile');
    $userid = $this->getUser()->getAttribute('id');

    //initilaze a image related properties
    $this->imgMimeType = "";
    $this->imgExtension = "";
    $this->uploadedFileName = $request->getParameter('qqfile');
    $this->newFileName = "";
    $this->dirRoot = sfConfig::get('app_planspace_rootdir')."\\".$userid;
    $this->thumbDir = "thumb";
    $this->hostPath =  sfConfig::get('app_planspace_hostpath')."/".$userid;
    $this->newFilePath = "";

    $this->_getImageProperties();

    if($this->_uploadProgress($this->newFileName))
    {
        $this->newFilePath  = $this->hostPath."/".$this->newFileName;
        $get_image = getimagesize($this->newFilePath);
        $this->imgMimeType = $get_image['mime'];
        //$this->_tranformImage();

        $obj = new stdClass();
        $obj->fileName = $this->hostPath."/".$this->newFileName;
        $obj->success = true;
        $obj->mime = $this->imgMimeType;
        print json_encode($obj);
    }

    return sfView::NONE;
  }
  private function _getImageProperties()
  {
    $arr_temp = explode(".",trim($this->uploadedFileName));
    $this->imgExtension = $arr_temp[count($arr_temp)-1];
    if(is_dir(sfConfig::get('app_planspace_rootdir')))
    {
        if(!is_dir($this->dirRoot))
            mkdir($this->dirRoot);
        if(!is_dir($this->dirRoot."\\".$this->thumbDir))
            mkdir($this->dirRoot."\\".$this->thumbDir);
        $planspace_files = scandir($this->dirRoot);
        //$this->newFileName = md5(count($planspace_files)+1).".".$this->imgExtension;
        $this->newFileName =md5(count($planspace_files)).".".$this->imgExtension;
    }
  }

anybody ,plz help me.

how to create randomsize images.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by diafol
0

I don't really get your query

You can create them on the fly with GD/IM library just set the width in the image tag. This seems to be a pretty intensive procedure server-side (10 image uploads, 3 resizes each).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.