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->newFilePath  = $this->hostPath."/".$this->newFileName;
        $get_image = getimagesize($this->newFilePath);
        $this->imgMimeType = $get_image['mime'];

        $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];
        $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.

Member Avatar

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).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.