K
K
Krestot2016-12-24 14:29:31
PHP
Krestot, 2016-12-24 14:29:31

How to parse image sizes?

There is a task to automatically go through the site and calculate the computed size of the images. In principle, the GTmetrix tool does what is needed, but requests for its api are limited.
a0ec27f1de5f43d2bbb13a80028507c2.png
How can you do it yourself?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
amorphine, 2016-12-24
@Krestot

PhantomJS + your script for working with the document.

T
ThunderCat, 2016-12-24
@ThunderCat

as I understand it, the problem is to calculate the size given by css, the real one can be obtained from getimagesize () for example, with the size on the site, you can use some selenium thread and javascript that will display all image sizes in a separate element. Then it remains to parse this element and that's it.

K
Kirill Gorelov, 2016-12-24
@Kirill-Gorelov

Alternatively https://regex101.com/r/TYgj87/1

A
Alexander Shelemetiev, 2017-05-23
@zoroda

It is not clear what you are trying to output in the statement IF((SELECT disposition FROM cdr WHERE uniqueid = uniqueid)='NO ANSWER','NO ANSWER' ,
'ANSWERED') as disposition
work like this:

SELECT calldate,
src,
dst,
dcontext,
channel,
dstchannel,
lastapp,
lastdata,
duration,
billsec,
MIN(uniqueid) as uniqueid1,
amaflags,
accountcode,
userfield
FROM cdr WHERE src='81113331110'
GROUP BY calldate,
src,
dst,
dcontext,
channel,
dstchannel,
lastapp,
lastdata,
duration,
billsec,
amaflags,
accountcode,
userfield
ORDER BY  (MIN(uniqueid)) DESC

E
Eugene, 2017-05-23
@Flashter

The problem here is
ORDER BY uniqueid DESC
You can't order anything that is defined as an alias.
Try
ORDER BY (MIN(uniqueid)) DESC

S
Stalker_RED, 2017-05-23
@Stalker_RED

I suspect that because of MIN(uniqueid)... ORDER BY uniqueid
Try to remove sorting, or sort by uniqueid1. If this is really the case, you can wrap the query in another SELECT and sort it already.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question