Suppose if you copy an image from another site to your site using the php copy function, then only one copied image is created in the uploads folder.
Tell me, how do I copy images from another site, so that all intermediate dimensions are created, which are selected in media settings?
those. 150x150, 300x300, 100x100, etc.
$attach_id = wp_insert_attachment( $attachment, $guid . $nameImg ); $attach_data = wp_generate_attachment_metadata( $attach_id, $guid . $nameImg ); wp_update_attachment_metadata( $attach_id, $attach_data ); This code only writes to the database.
Plugins do not fit, you need to make your plugin
wp_generate_attachment_metadataare passed to thewp_insert_attachmentandwp_generate_attachment_metadatafunctions. In theory, the file name is identical in calls to two functions. What could be the problem yet? - word