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
Related Q & A:
- How can I print a big image on 4 sheets A4?Best solution by Yahoo! Answers
- How can I import my bookmarks from my yahoo browser?Best solution by productforums.google.com
- How can I erase the history of my Yahoo browser?Best solution by Yahoo! Answers
- How do i get yahoo mobile on my psp browser?Best solution by Yahoo! Answers
- How do i get sound from my laptop to my tv, via HDMI?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.