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
Logo Design and Graphic Shirt/Hoodie Designs for Basketball Theme
Category: Graphic Design, Illustration, Logo Design, Photoshop, T Shirts
Budget: $50 - $100 USD
21 Nov 2025 20:50 GMT
Migration of SaaS CRM Platform to Laravel 11 and Next.js
Category: HTML, Laravel, MySQL, Next.js, PHP, Web Design
Budget: €5000 - €10000 EUR
21 Nov 2025 20:32 GMT
CRM Telecalling for Realtors
Category: Account Management, Business Development, CRM, Customer Service, Lead Generation, Marketing, Real Estate, Sales, Telemarketing
Budget: ₹100 - ₹400 INR
21 Nov 2025 17:04 GMT
Fix Push Notifications Issue
Category: Database Management, JavaScript, Linux, Node.js, PHP, React.js, Web API, Web Development
Budget: £20 - £250 GBP
21 Nov 2025 17:03 GMT
Synchronisation GitHub et App Mobile
Category: Android, Git, GitHub, IOS Development, IPhone, Mobile App Development, PhoneGap, React Native
Budget: $30 - $250 USD
21 Nov 2025 17:03 GMT
SketchUp Interior Walkthrough Video
Category: 3D Animation, 3D Modelling, 3D Rendering, 3ds Max, Architectural Visualization, SketchUp, V Ray, Video Editing
Budget: €30 - €250 EUR
21 Nov 2025 17:01 GMT
English-Iraqi Arabic Website Translation
Category: Content Management System (CMS), Content Writing, Copywriting, Customer Experience, Product Descriptions, Translation, Website Localization
Budget: ₹1500 - ₹12500 INR
21 Nov 2025 17:01 GMT
Experto en Salesforce Marketing Cloud
Category: Automation, CRM, Customer Retention, Data Analysis, Data Integration, Email Marketing, Salesforce Marketing Cloud, SQL
Budget: $250 - $750 USD
21 Nov 2025 17:01 GMT
Employee Handbook Creation
Category: Business Writing, Content Development, Content Writing, Documentation, Editing, Human Resources, Technical Writing, Writing
Budget: $30 - $250 USD
21 Nov 2025 17:00 GMT
Make a wordpress website with elementor based on my figma design
Category: Coding, Elementor, Email Marketing, Figma, Web Design, WordPress
Budget: $30 - $50 USD
21 Nov 2025 17:00 GMT
I have got my job portal already developed theough web development company. Now i want to launch the same in market with soefic focused areas and niche. Inwant social media professional who can work on promoting brand through social media audience follow
Category: Brand Management, Content Creation, Digital Marketing, Email Marketing, Facebook Marketing, Graphic Design, Influencer Marketing, Social Media Marketing
Budget: ₹12500 - ₹37500 INR
21 Nov 2025 16:59 GMT
Strategi Dana Medis Mendesak
Category: Article Writing, Catch Phrases, Copywriting, Crowdfunding, Digital Marketing, Fundraising, Grant Writing, Product Descriptions
Budget: $25 - $50 USD
21 Nov 2025 16:59 GMT
Facebook Lead-Gen Campaign Manager
Category: Content Strategy, Conversion Rate Optimization, Digital Marketing, Facebook Ads, Facebook Marketing, Facebook Pixel, Lead Generation, Social Media Marketing
Budget: $8 - $15 USD
21 Nov 2025 16:59 GMT
Administrative Assistant for Australian Building & Design Firm (8–12 Month Contract, 25–35 hrs/week)
Category: Admin Support, AutoCAD, Building Design, Construction Management, Customer Service, Excel, Project Management, Time Management, Training
Budget: ₹400 - ₹750 INR
21 Nov 2025 16:59 GMT
Minimalistic Corporate Mural
Category: Art Installation, Graphic Design, Illustration, Mural Painting
Budget: $3000 - $5000 USD
21 Nov 2025 16:57 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-2024
1001 Freelance Projects