$uid = $request_user->ID;        $cropped_full = USER_AVATAR_UPLOAD_PATH.“{$uid}/”.time().“-bpfull.jpg”;     $cropped_thumb = USER_AVATAR_UPLOAD_PATH.“{$uid}/”.time().“-bpthumb.jpg”;          // Create image from file         switch(strtolower($_FILES[‘file’][‘type’]))         {             case ‘image/jpeg’:                 $fn = $_FILES[‘file’][‘tmp_name’];                 $height_width = $this->get_image_ratio_height_width($fn);                                  $width = $height_width[‘width’];                 $height = $height_width[‘height’];                 $size = $height_width[‘size’];                 $src = imagecreatefromstring(file_get_contents($fn));                 $dst = imagecreatetruecolor($width,$height);                 imagecopyresampled($dst,$src,0,0,0,0,$width,$height,$size[0],$size[1]);                 imagedestroy($src);                                  imagejpeg($dst,$cropped_full); // adjust format as needed                 imagedestroy($dst);                 $url=user_avatar_fetch_avatar( array( ‘html’=>false, […]

     $request_user = $this->validation->get_user_info();    if(!$request_user)    return $this->validation->response(“Missing header or invalid authtoken”, null , 400);       $uid = $request_user->ID;    global $user_current_id_API;    $user_current_id_API = $uid;    $cropped_full = USER_AVATAR_UPLOAD_PATH.“{$uid}/”.time().“-bpfull.jpg”;     $cropped_thumb = USER_AVATAR_UPLOAD_PATH.“{$uid}/”.time().“-bpthumb.jpg”;          $uploadedfile = $_FILES[‘file’];         $upload_overrides = array( ‘test_form’ => false );                  add_filter(‘wp_handle_upload_prefilter’, ‘custom_upload_filter’ );         function custom_upload_filter( $file ){             $file[‘name’] = […]

Displaying notification in different form is common these days. for example notification message notificat in in facebook and new mail notification by gmail. Many people are concerned about implementing the the real time notification system correctly in a hassle free manner. And the good thing about this is that you can easily turn this out in […]

Displaying notification in different form is common these days. for example notification message notificat in in facebook and new mail notification by gmail. Many people are concerned about implementing the the real time notification system correctly in a hassle free manner. And the good thing about this is that you can easily turn this out in […]

Welcome to Django Mptt Demo Welcome to Django mptt demo module. This demo explains how to create tree level category and demonstrate mtpp library Repo : https://bitbucket.org/cyberkishor/django-mptt-demo/wiki/Home   Django Mtpp demo features Create Tree level category Display tree level category list in admin panel Display category as tree in another db relation like forenkeyTree (example used […]

dumpdata command It is a django management command, which can be use for database backup(import/export) it can be model instance or all database dumpdata: basic command for backup all database 1 ./manage.py dumpdata > db.json   dumpdata  specific app Following command will dump the content in django admin app intoadmin.json file 1 ./manage.py dumpdata admin > admin.json dumpdata […]

We’re going to use Homebrew to install mod_wsgi. There is some extra step to install it, you can read https://github.com/Homebrew/homebrew-apache to have more information. Then, load new Formulas into brew: 1 brew tap homebrew/apache Finally install mod_wsgi 1 brew install mod_wsgi Once mod_wsgi installed, we’ll enable it in Apache: edit /etc/apache2/http.conf and add this line 1 2 LoadModule wsgi_module /usr/local/Cellar/mod_wsgi/3.4/libexec/mod_wsgi.so Test the config […]

While we need links on different column we can use “get_list_display_links” function default given by Django framework and we simply define links with condition also like: 1 2 3 4 5 6 7 def get_list_display_links(self, request, list_display):     group, created = Group.objects.get_or_create(name=“Administrator”)     if True if group in request.user.groups.all() else False or request.user.is_superuser:         return [‘get_full_name’, ’email’]     return None […]