How to get image's original size (height, width) and set it in ImageView

I have a Json file contains images url, Then I display them using Glide intoCardView
java :

Glide
               .with(context)
               .load(post.getImgUrl())
               .listener(new RequestListener<String, GlideDrawable>() {
                   @Override
                   public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
                       return false;
                   }

                   @Override
                   public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target,
                                                  boolean isFromMemoryCache, boolean isFirstResource) {

                       mProgress.hide();
                       return false;

                   }
               })
               .priority(Priority.HIGH)
               .diskCacheStrategy(DiskCacheStrategy.ALL)
               .into(image);

xml :

<android.support.v7.widget.CardView  xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:app="http://schemas.android.com/tools"
    android:id="@+id/cardview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:focusable="true"
    card_view:cardPreventCornerOverlap="false"
    app:ignore="NamespaceTypo">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="3dp"
        android:adjustViewBounds="true"
        android:scaleType="fitXY"/>
</android.support.v7.widget.CardView>

Now I want to get Width and Height of each Image in json, to set it in the ImageView(height, width)

So I already tried this :

int width = resource.getIntrinsicWidth();
int height = resource.getIntrinsicHeight();

But it didn't work for me