'texploto-ai-desktop.png',11=>'texploto-personal-agent.png',8=>'texploto-ai-music.png']; function tx_measure_file($path,$url){ if(!is_file($path))throw new RuntimeException('Missing measurement input'); $size=getimagesize($path); return ['url'=>$url,'bytes'=>filesize($path),'width'=>$size[0],'height'=>$size[1],'mime'=>$size['mime'],'sha256'=>hash_file('sha256',$path)]; } foreach($sources as$post_id=>$filename){ $media=get_post_thumbnail_id($post_id);$meta=wp_get_attachment_metadata($media);$full=get_attached_file($media);$cover=$meta['sizes']['texploto-cover']??null; if(!$cover)throw new RuntimeException('Missing cover'); $original=tx_measure_file('/srv/texploto/import/assets/'.$filename,home_url('/laboratorio-datos/imagenes-ia/'.$filename)); $converted=tx_measure_file($full,wp_get_attachment_url($media)); $web=tx_measure_file(dirname($full).'/'.$cover['file'],dirname(wp_get_attachment_url($media)).'/'.$cover['file']); $rows[]=['post_id'=>$post_id,'title'=>get_the_title($post_id),'original'=>$original,'converted'=>$converted,'web'=>$web,'format_reduction_percent'=>round(100*(1-$converted['bytes']/$original['bytes']),2),'total_reduction_percent'=>round(100*(1-$web['bytes']/$original['bytes']),2)]; } echo json_encode(['measured_at'=>gmdate(DATE_ATOM),'method'=>'Actual file sizes, dimensions, MIME types and SHA256 of three source PNGs and their existing WordPress full-size and 1440x810 WebP files. No image generated or modified during measurement. Full-size comparison retains dimensions; cover comparison also includes resizing and cropping. This measures file weight, not visual quality, loading time or SEO.','rows'=>$rows],JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);