Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
This query is marked as a draft
This query has been published
by
Dispenser
.
Toggle Highlighting
SQL
-- 2> /dev/null; date; echo ' /* GIF metadata validity check * * License: Public domain * Runtime: 5 minutes */ USE commonswiki_p; CREATE DATABASE IF NOT EXISTS u2029__p; /* https://noc.wikimedia.org/conf/highlight.php?file=CommonSettings.php */ SET @wgMaxImageArea=10e7, @wgMaxAnimatedGifArea=10e7; CREATE TEMPORARY TABLE u2029__p.gif_size ( img_framecount INT NOT NULL, img_looped TINYINT NOT NULL, img_duration FLOAT NOT NULL ) ENGINE=MyISAM AS SELECT /*SLOW_OK*/ page_id AS img_page, img_name, img_size, img_width, img_height, img_bits, img_timestamp, img_user_text, SUBSTRING_INDEX(SUBSTRING_INDEX(img_metadata, "\"frameCount\";i:", -1), ";", 1) AS img_framecount, SUBSTRING_INDEX(SUBSTRING_INDEX(img_metadata, "\"looped\";b:", -1), ";", 1) AS img_looped, SUBSTRING_INDEX(SUBSTRING_INDEX(img_metadata, "\"duration\";d:", -1), ";", 1) AS img_duration FROM image JOIN page ON page_namespace=6 AND page_title=img_name WHERE img_major_mime="image" AND img_minor_mime="gif" AND img_media_type="BITMAP"; SELECT CONCAT("align=left | [[:File:", REPLACE(img_name, "_", " "), "]]") AS "File", IF(img_framecount>1 AND img_looped=0,CONCAT("No loop, ",CEIL(img_duration)," s"), IF(img_duration>120,CONCAT(ROUND(img_duration/60,1)," mins"), "")) AS "Playback", img_timestamp, img_framecount, img_size, img_size/(img_width*img_height*img_framecount+768*img_framecount+8*1024) AS cmprs_ratio FROM u2029__p.gif_size LEFT JOIN categorylinks ON cl_from=img_page AND cl_to IN ("True_color_GIFs") WHERE cl_from IS NULL AND ( /* Check compression ratio */ img_size/(img_width*img_height*img_framecount+768*img_framecount+8*1024)>=1.00 OR /* Sanity check */ img_width<=0 OR img_height<=0 OR img_duration<0.0 OR img_framecount<=0 OR img_looped NOT IN (0,1) )
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...