1001 Freelance Projects
Latest Projects from
Freelance Marketplaces
View Project
View this project in detail
(Note: you will be redirected to external marketplace)
Project title:
Debug code to upload an image file to ChatGPT
Posted by:
External project from PeoplePerHour
Started:
03-Mar-2025 04:33 GMT
Description:
I have the following code written in an attempt to upload an image file to ChatGPT that can be read and understood along with accompanying text. It isn't working and need to get it to work.

' Function to extract an image path from a string
Function ExtractImagePath(ByVal text As String) As String
Dim regEx As Object
Dim matches As Object
Dim match As Object

' Create regex object
Set regEx = CreateObject("VBScript.RegExp")

' Set regex pattern to look for image paths
' This pattern looks for paths ending with .png, .jpg, .jpeg, or .bmp
regEx.Pattern = "(([a-zA-Z]:\\|\\\\)[^\s\\/:*?""|]+(\\[^\s\\/:*?"" 0 Then
ExtractImagePath = matches(0).Value
Else
ExtractImagePath = ""
End If

' Clean up
Set regEx = Nothing
Set matches = Nothing
End Function

' Function to read an image file and convert it to base64
Function GetBase64FromImage(ByVal filePath As String) As String
On Error GoTo ErrorHandler

Dim streamObj As Object
Dim bytes() As Byte

' Create ADODB.Stream object
Set streamObj = CreateObject("ADODB.Stream")

' Open the stream and read the file
With streamObj
.Type = 1 ' Binary
.Open
.LoadFromFile filePath
bytes = .Read
.Close
End With

' Convert binary data to base64
GetBase64FromImage = Base64Encode(bytes)

' Clean up
Set streamObj = Nothing
Exit Function

ErrorHandler:
GetBase64FromImage = ""
Debug.Print "Error reading image: " & Err.Description
End Function

' Function to encode binary data as base64
Function Base64Encode(ByRef arrData() As Byte) As String
Dim objXML As Object
Dim objNode As Object

' Create MSXML DOMDocument
Set objXML = CreateObject("MSXML2.DOMDocument")

' Create a base64 node
Set objNode = objXML.createElement("b64")

' Set the datatype to bin.base64
objNode.DataType = "bin.base64"

' Set the node value to the binary data
objNode.nodeTypedValue = arrData

' Get the base64 string
Base64Encode = objNode.text

' Clean up
Set objNode = Nothing
Set objXML = Nothing
End Function

' Debug function to test API connection and image handling
Sub DebugGPTResponse()
Dim testPrompt As String
Dim result As String
Dim errorMsg As String

On Error GoTo ErrorHandler

' Test prompt with an image path
testPrompt = "What can you see in this image? C:\Users\Images\test_image.png Please describe it in detail."

' Call the function
result = GetGPTResponse(testPrompt)

' Output success message with the response
MsgBox "Connection successful. Response: " & result
Exit Sub

ErrorHandler:
errorMsg = "Error " & Err.Number & ": " & Err.Description
MsgBox "Connection failed. " & errorMsg
End Sub
Project ID:
3424382
Project category:
Project budget:
View this project in detail
(Note: you will be redirected to external marketplace)
Last Projects / Browse Projects
  Project Started
Tally ERP9 Receipt Voucher Popup
Category: Bank Reconciliation, Bookkeeping, Data Entry, Database Management, Finance, Inventory Management, MySQL, PHP, Technical Documentation, Xero
Budget: ₹12500 - ₹37500 INR
08 May 2026 10:03 GMT
Crypto Brokerage Procurement Specialist Needed
Category: Blockchain, Cryptocurrency, Financial Consulting, Market Analysis, Market Research, Procurement, Risk Management, Sales Management
Budget: $3000 - $5000 USD
08 May 2026 10:02 GMT
Young Female Voiceover and Actress Required
Category: Audio Production, Audio Services, Hindi Translator, Music, Voice Talent
Budget: ₹37500 - ₹75000 INR
08 May 2026 10:02 GMT
Female Voiceover for Young Adult Character
Category: Audio Production, Audio Services, Music, Voice Talent
Budget: ₹1500 - ₹12500 INR
08 May 2026 10:02 GMT
Boxing & Martial Arts Book Interior Illustrations
Category: 2D Drawing, Art Consulting, Art Installation, Digital Art, Drawing Artist, Graphic Design, Illustration, Photoshop, Visual Arts
Budget: $10 - $1000 USD
08 May 2026 10:01 GMT
FiveM RP Discord Outreach Specialist (Commission Only)
Category: Affiliate Marketing, Discord, Lead Generation, Sales, Social Media Marketing
Budget: $10 - $30 USD
08 May 2026 10:01 GMT
Professional presentation about advanced healthcare in the UAE
Category: Adobe Creative Suite, Brochure Design, Business Writing, Content Writing, Data Visualization, Graphic Design, Infographics, Market Research, Powerpoint, Visual Design
Budget: $30 - $250 USD
08 May 2026 10:01 GMT
Odoo 19 POS Setup UK
Category: ERP, Inventory Management, Odoo, Payment Processing, PHP, Point Of Sale, Python, Software Architecture
Budget: $15 - $25 USD
08 May 2026 10:00 GMT
Replicate Reference Websites in WordPress - FRESHERS ONLY.
Category: CSS, HTML, JavaScript, PHP, Web Design, Web Development, WordPress, WordPress Design
Budget: ₹100 - ₹101 INR
08 May 2026 10:00 GMT
Urgent Flutter UI Overhaul
Category: Android, App Development, Dart, Flutter, Graphic Design, IOS Development, IPhone, Mobile App Development
Budget: ₹600 - ₹1500 INR
08 May 2026 09:58 GMT
Engaging Storytelling Video Scripts
Category: Computer Support, Creative Writing, Editing, Fiction, Gujrati Translator, Hindi Translator, Script Writing, Short Stories, Video Editing, Video Production
Budget: ₹12500 - ₹37500 INR
08 May 2026 09:56 GMT
Diego Llatas, experienced and open to satisfy those Data Entry and/or Data Processing jobs. Warm regards
Category: Copy Typing, Data Analysis, Data Analytics, Data Cleansing, Data Collection, Data Entry, Data Integration, Data Management, Data Processing, Excel
Budget: €250 - €750 EUR
08 May 2026 09:56 GMT
Rewrite CV for ATS Success
Category: Article Rewriting, Content Writing, Copywriting, CV Design, Editing, Graphic Design, Keyword Research, Proofreading, Research Writing, Word Processing
Budget: €8 - €30 EUR
08 May 2026 09:56 GMT
Hotel Booking Website Development
Category: Database Management, Frontend Development, Graphic Design, HTML, Payment Gateway Integration, PHP, UI / User Interface, User Experience Research, Web Development, Web Design
Budget: ₹150000 - ₹250000 INR
08 May 2026 09:54 GMT
B2B LinkedIn & HubSpot Ads
Category: B2B Marketing, Conversion Rate Optimization, CRM, Google Adwords, Hubspot, Linkedin
Budget: $2 - $8 USD
08 May 2026 09:53 GMT
Browse All Projects
Projects by Skills ...
android
ajax
asp
aspnet
cms
cpp
csharp
css
delphi
design
drupal
excel
facebook
flash
html
java
javascript
joomla
iphone
mysql
photoshop
php
python
ruby
seo
sql
sysadm
translate
typing
twitter
vbnet
xml
wordpress
writing
New!
Проекты на русском
(Projects in Russian)

Copyright © 2005-2025
1001 Freelance Projects