Question: **1.**

In controller I have code like

**2.**

```
foreach($data['response']['data'] as $r) {
        $data['members'.$i] = $this->facebook->api( '/'.$r['id'].'/members');
         $i++;
    }
$this->load->view('index',$data);

```

**3.**

In view page I need value of member1,member2...upto membern.. but I could not understand how to get them. If any other way is there then tell me. Also I am sending the no of groups in $data. I want to see groupname(No of members).

Answer: 
As an extra to Rajat Singhal's answer (sorry, i don't have enough reputation to post a comment):

My drawable was having the wrong size (it was smaller), because drawables take into account the screen density. In order to preserve the original image size, I ended up doing this, in the fetchDrawable method:

```
public Drawable fetchDrawable(String urlString) {
        try {
            InputStream is = (InputStream) new URL(urlString).getContent();
            Bitmap bmp = BitmapFactory.decodeStream(is);
            Drawable drawable = new BitmapDrawable (context.getResources(), bmp);
            drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
            return drawable;
        } catch (Exception e) {
            return null;
        }
    }

```
I just wanted to fix the size of the image from Rajat's answer, the image will take the full width of the textview and keeps the aspect ratio for the height. here's my update:

```
    public Drawable getDrawable(String source)
    {
        if(source.matches("data:image.*base64.*"))
        {
            String base_64_source = source.replaceAll("data:image.*base64", "");
            byte[] data = Base64.decode(base_64_source, Base64.DEFAULT);
            Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
            Drawable image = new BitmapDrawable(context.getResources(), bitmap);

            float ratio = container.getWidth() / image.getIntrinsicWidth();
            int width = container.getWidth();
            int height = Math.round(image.getIntrinsicHeight() * ratio);

            image.setBounds(0, 0, width, height);
            return image;
        }
        else
        {
            ....
        }
    }

    public class ImageGetterAsyncTask extends AsyncTask<String, Void, Drawable>
    {
        ....

        @Override
        protected void onPostExecute(Drawable result)
        {
            if(result != null)
            {
                float ratio = container.getWidth() / result.getIntrinsicWidth();
                int width = container.getWidth();
                int height = Math.round(result.getIntrinsicHeight() * ratio);
                urlDrawable.setBounds(0, 0, width, height); //set the correct bound according to the result from HTTP call
                urlDrawable.drawable = result; //change the reference of the current drawable to the result from the HTTP call
                URLImageParser.this.container.invalidate(); //redraw the image by invalidating the container
            }
        }

        public Drawable fetchDrawable(String urlString)
        {
            try
            {
                InputStream is = (InputStream) new URL(urlString).getContent();
                Bitmap bmp = BitmapFactory.decodeStream(is);
                Drawable drawable = new BitmapDrawable (context.getResources(), bmp);

                float ratio = container.getWidth() / drawable.getIntrinsicWidth();
                int width = container.getWidth();
                int height = Math.round(drawable.getIntrinsicHeight() * ratio);

                drawable.setBounds(0, 0, width, height);
                return drawable;
            }
            catch (Exception e)
            {
                return null;
            }
        }

    }
}

```

However, Ranjat's solution shows only 1 image. If you wanna show multiple images then you need to use `ImageSpan` inside `SpannableStringBuilder` if you need an example let me know in a comment.