From 53cb8bc3a7a5aa8f81ba90c89957e222552ffdf5 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 6 Jan 2026 17:39:14 +0000
Subject: [PATCH 1/4] Initial plan
From c456b9e800975ca4c8e33930b3f655c0db8beb42 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 6 Jan 2026 17:51:00 +0000
Subject: [PATCH 2/4] feat: add image upload from URL option for speakers and
companies
Co-authored-by: Francisca105 <65908870+Francisca105@users.noreply.github.com>
---
.../components/companies/CompanyInfoForm.vue | 119 +++++++++++++++--
.../companies/CreateCompanyForm.vue | 118 +++++++++++++++--
.../components/speakers/CreateSpeakerForm.vue | 120 ++++++++++++++++--
.../components/speakers/SpeakerInfoForm.vue | 119 +++++++++++++++--
4 files changed, 432 insertions(+), 44 deletions(-)
diff --git a/frontend/src/components/companies/CompanyInfoForm.vue b/frontend/src/components/companies/CompanyInfoForm.vue
index 97487d6c..8fca7a01 100644
--- a/frontend/src/components/companies/CompanyInfoForm.vue
+++ b/frontend/src/components/companies/CompanyInfoForm.vue
@@ -48,16 +48,44 @@
-
-
- Recommended: Square image, minimum 256x256px, max 10MB
-
+
+
+ Upload File
+ From URL
+
+
+
+
+ Recommended: Square image, minimum 256x256px, max 10MB
+
+
+
+
+
+ Enter the URL of an image to use
+
+
+ Loading image...
+
+
+
{{
errors.image
}}
@@ -98,6 +126,7 @@ import type { UpdateCompanyData } from "@/dto/companies";
import Button from "../ui/button/Button.vue";
import Input from "../ui/input/Input.vue";
import Label from "../ui/label/Label.vue";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
interface Props {
isLoading?: boolean;
@@ -120,6 +149,9 @@ const emit = defineEmits<{
const imagePreview = ref("");
const selectedImageFile = ref(null);
const errors = ref>({});
+const imageInputMode = ref("file");
+const imageUrl = ref("");
+const isLoadingImageUrl = ref(false);
const formData = reactive<
Pick
@@ -173,6 +205,73 @@ const handleImageChange = (event: Event) => {
}
};
+// Handle image URL input
+const handleImageUrlChange = async () => {
+ const url = imageUrl.value.trim();
+ if (!url) {
+ return;
+ }
+
+ // Validate URL format
+ try {
+ new URL(url);
+ } catch {
+ errors.value.image = "Please enter a valid URL";
+ return;
+ }
+
+ isLoadingImageUrl.value = true;
+ delete errors.value.image;
+
+ try {
+ const response = await fetch(url);
+ if (!response.ok) {
+ throw new Error("Failed to fetch image");
+ }
+
+ const contentType = response.headers.get("content-type");
+ if (!contentType || !contentType.startsWith("image/")) {
+ throw new Error("URL does not point to a valid image");
+ }
+
+ const blob = await response.blob();
+
+ // Check file size (10MB limit)
+ if (blob.size > 10 << 20) {
+ errors.value.image = "Image file size must be less than 10MB";
+ return;
+ }
+
+ // Extract filename from URL or use a default
+ const urlPath = new URL(url).pathname;
+ const filename = urlPath.split("/").pop() || "image";
+ const extension = contentType.split("/")[1] || "png";
+ const finalFilename = filename.includes(".")
+ ? filename
+ : `${filename}.${extension}`;
+
+ // Create a File object from the blob
+ const file = new File([blob], finalFilename, { type: contentType });
+ selectedImageFile.value = file;
+
+ // Create preview
+ const reader = new FileReader();
+ reader.onload = (e) => {
+ imagePreview.value = e.target?.result as string;
+ };
+ reader.readAsDataURL(blob);
+
+ // Emit the selected file to parent component
+ emit("imageSelected", file);
+ } catch (error) {
+ console.error("Error fetching image from URL:", error);
+ errors.value.image =
+ "Failed to load image from URL. Please check the URL and try again.";
+ } finally {
+ isLoadingImageUrl.value = false;
+ }
+};
+
const handleSubmit = () => {
if (isValid.value) {
emit("submit", {
diff --git a/frontend/src/components/companies/CreateCompanyForm.vue b/frontend/src/components/companies/CreateCompanyForm.vue
index 64529b73..e7641c0b 100644
--- a/frontend/src/components/companies/CreateCompanyForm.vue
+++ b/frontend/src/components/companies/CreateCompanyForm.vue
@@ -88,17 +88,45 @@
-
-
-
- Recommended: Square image, minimum 256x256px, max 10MB
-
+
+
+
+ Upload File
+ From URL
+
+
+
+
+ Recommended: Square image, minimum 256x256px, max 10MB
+
+
+
+
+
+ Enter the URL of an image to use
+
+
+ Loading image...
+
+
+
{{
errors.image
}}
@@ -122,7 +150,7 @@
Back
-