Question: i want to **fit image with parent** div (image-container) with **corect ratio**

```css
.image-container{

height: 195px;
    border-radius: 10px;
    position: relative;
    width: 482px;
    width: 482px;

    }

    img{
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    object-fit: contain;
overflow:hidden
    }

    .gray-layer{
    width: 482px;
    height: 195px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    background-color: rgba(0, 0, 0, 0.4);
    position: absolute;
    top: 0;
    }
```

```html
<div class="image-container">
<img src="https://javadeveloperzone.com/wp-content/uploads/2019/02/JAVA-PARSE-LARGE-JSON-FILE-GSON-EXAMPLE-1024x488.png">
<div class="gray-layer">
</div>
</div>
```

my above code doesn't fit the image. please help me

Answer: 
In order to achieve what you want you need to use `esc`:

```
macro t(a, b, c)
    quote
        local a1 = $(esc(a))
        local b1 = $(esc(b))
        local c1 = $(esc(c))
        println(:c, " = ", c1)
        (a1, b1, c1)
    end
end

```

Note that I define variables `a1`, `b1`, and `c1` once and then reuse them. The reason is that if you have written something like:

```
macro t(a, b, c)
    quote
        println(:c, " = ", $(esc(c)))
        ($(esc(a)), $(esc(b)), $(esc(c)))
    end
end

```

which is natural to do (or maybe not :)), you would get problems as `c` would be evaluated twice, as eg. in this example:

```
julia> macro t(a, b, c)
           quote
               println(:c, " = ", $(esc(c)))
               ($(esc(a)), $(esc(b)), $(esc(c)))
           end
       end
@t (macro with 1 method)

julia> function test()
           @t 1 2 rand()
       end
test (generic function with 1 method)

julia> test()
c = 0.03771143425073453
(1, 2, 0.1819496773810383)

```

Note that a different value is printed and different value is returned. This problem was present in your original macro (even if it used global variables as @Bill noted):

```
julia> macro t(a, b, c)
           quote
               println(:c, " = " , $c)
               ($a, $b, $c)
           end
       end
@t (macro with 1 method)

julia> @t 1 2 rand()
c = 0.7021554643798531
(1, 2, 0.6363717837673994)

```

In general I think that `@code_lowered` and `@macroexpand` macros will be useful for you when you debug code using metaprogramming.
Such macros are evaluated in such a way that any variable names not local to the macro function itself are considered global. The calling scope at the point of macro is not used.

So this works:

```
macro t(a, b, c)
    quote
        println(:c, " = " , $c)
        ($a, $b, $c)
    end
end

function test()
    # works:
    @t 1 2 3

    x = π  # this x is not seen inside the macro's scope
    @t 1 2 "x is $x"
end

x = 2π  # this one is global

test()

```