How to get mobile scrollbar width?

How can I get the computed image width after browser rendering via PHP?

  • I have a server side script that gets the HTML contents of a URL. I need it to get the computed width of elements (specifically images) as the browser would render if with all the CSS attributes applied to it. Something that will do what qQuery's .width method does but in PHP. Are there any libraries out there capable of doing this? I've heard of Rhino but I am not sure if it has this specific capability. I did ask this in StackOverflow but figured it wouldn't hurt to see if the Quora community had any insight: http://stackoverflow.com/questions/15033194/how-can-i-get-the-computed-image-width-after-browser-rendering-via-php

  • Answer:

    For achieving this you need 2 things. The DOM Parser class in PHP and the GD library extension. A simple approach would be to traverse to the element in the DOM which contains the desired image, get its location and call: $size = getimagesize($filename); Although, getimagesize() works without GD library, but performing any other image specific actions would require the presence of GD library.

Deepanshu Mehndiratta at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.