I’m using a package https://www.php-imap.com/ I have an email with embedded images starting with imap// but when I read the HTML Content it just shows me the cid: code like.

but when I inspect it in Thunderbird shows me something like this

Now the issue is this package gives me this image as an attachment and I’m storing these attachments in DB when I get embedded images as an attachment it causes an issue validating the actual attachments I don’t want the embedded images just want actual attachments.
$this->saveAttachments($message->getAttachments(), $contactMoment);
private function saveAttachments(AttachmentCollection $attachmentCollection, Model $model): void
{
$disk = config('filesystems.default');
if (config('services.sharepoint.enabled')) {
$disk = 'sharepoint';
}
foreach ($attachmentCollection as $attachment){
dump([
'Attachments' => [
'Size' => $attachment->getSize(),
'Name' => $attachment->getName(),
'Mime' => $attachment->getMimeType()
]
]);
$mimeType = $attachment->getMimeType();
$size = $attachment->getSize();
$name = $attachment->getName();
$content = $attachment->getContent();
if (isset($attachment->getAttributes()['modification-date'])){
$modified_date = $attachment->getAttributes()['modification-date']->toString();
}else{
$modified_date = Carbon::now()->format('Y-m-d H:i:s');
}
$message_id = md5($content.$modified_date);
$docx = Documents::where([
'attachment_id' => $message_id,
])->exists();
if(!$docx){
if(!is_dir(storage_path('documents'))){
mkdir(storage_path('documents'), 0777);
}
file_put_contents(storage_path('documents/'.$name), $content);
$file_path = sprintf(
"documents/%s/%s",
$this->currentProject->code,
$name
);
$link = Storage::disk($disk)->put(
$file_path
, file_get_contents(storage_path('documents/'.$name)));
unlink(storage_path('documents/'.$name));
$storedDocument = Documents::create([
'attachment_id' => $message_id,
'path' => $file_path,
'size' => $size,
'name' => $name,
'mimetype' => $mimeType,
'type' => $disk
]);
$storedDocument->contactmoments()->syncWithoutDetaching([$model->id]);
}
}
}