Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting a CSS attribute from PHP
    primarykey
    data
    text
    <p>It's my first time asking here (I have visited the site several times, but never asked). Well, let's go to the question:</p> <p>It happens that I'm developing a live image resizer (I know it already exists, but I'm doing my own for my own projects). It has three parameters: the image path (obviously), the size I want to resize and the extra margin I want to add. The idea is to resize the image inside a box with square dimentions. The problem is, the size I want to resize depends on the size of the outer box. For example, I have this HTML code:</p> <pre><code>&lt;div class="image_outer_box"&gt; &lt;img width="300px" height="199px" style=" margin: 65.5px 15px;" src="img.jpg"&gt; &lt;/div&gt; </code></pre> <p>The properties of "image_outer_box" are the following:</p> <pre><code>.image_outer_box { height: 330px; width: 330px; border:solid 1px #737373; } </code></pre> <p>The function I call is this:</p> <pre><code>liveResize($img, $size, $extramargin); </code></pre> <p>The problem here is when I send the $size, since I must be aware of the CSS properties of "image_outer_box" in order to make the right resize. And, as you can see, it's not only a matter of the size specified in "image_outer_box" but the margin I want to add. Actually, I wanted to add 15px of extra margin for the image and resize the image inside 300x300.</p> <p>It's not critical to have a way to get the CSS attributes from this particular class, but it would help if I (and other developers) can apply the function without being aware of the CSS attributes of the container where the image will be placed.</p> <p>If there's a way to make it, I would be great.</p> <p>Thanks! (for the other times I came here to search a solution and I found it!!!)</p> <p>EDIT: I found a way that doesn't require to get the CSS properties, but still I would like to have info for this matter. Thanks for those who tried to help 'til now!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload