Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在不打开 .jpeg 或 .png 文件的情况下判断其尺寸?
如果无法确定尺寸,如何自动裁剪图像?
我正在使用 PHP 和 JS。
list($width, $height) = getimagesize("img.jpg"); or $im=imagecreatefromjpeg("image_testin_1.JPG"); imagetruecolortopalette($im, false, 255); $w = imagesx($im);//provide width of full page $h = imagesy($im);//provide height of full page