Output not displaying on mobile
Unanswered
False honey ant posted this in #help-forum
False honey antOP
Hello everyone,
I am stuck on an issue with my app pixelperfecthome.com. Is an app that takes in an image of your home and generates an ai photo based on a theme you specify.
The app loads the output image on my computer, my laptop, even when I inspect element and toggle the device as a phone. But for some reason when I try generating an image from my phone it only shows a broken jpeg symbol.
This is the code, PreviewImg Component:
I tried using both next/image and regular html img tag but both doesn't work.
I am stuck on an issue with my app pixelperfecthome.com. Is an app that takes in an image of your home and generates an ai photo based on a theme you specify.
The app loads the output image on my computer, my laptop, even when I inspect element and toggle the device as a phone. But for some reason when I try generating an image from my phone it only shows a broken jpeg symbol.
This is the code, PreviewImg Component:
'use client'
import React, { use } from 'react'
import logoicon from '@/assets/pixel-perfect-home-logo-slate.svg';
import {useFileName, useLoading, useOutput} from '@/store/useStore';
import Image from 'next/image';
function PreviewImg() {
const isLoading = useLoading((state:any) => state.isLoading);
const isGenerating = useLoading((state:any) => state.isGenerating);
const output = useOutput((state:any) => state.output);
const fileName = useFileName((state:any) => state.fileName);
return isLoading ? (
<div className={${isGenerating && "animate-pulse"} md:w-[500px] w-[350px] h-[200px] my-auto md:h-[300px] bg-slate-100 rounded-lg flex items-center justify-center}>
<Image src={logoicon} alt='place holder' height={60} width={60} />
</div>
) : (
<div className='my-auto '>
<img src={output} alt='output' className='object-cover rounded-lg'/>
<p className='text-sm text-slate-700'>{fileName}</p>
</div>
)
}
export default PreviewImgI tried using both next/image and regular html img tag but both doesn't work.
1 Reply
False honey antOP
page:
'use client'
import DownloadBtn from '@/components/DownloadBtn'
import GenerateBtn from '@/components/GenerateBtn'
import PreviewImg from '@/components/PreviewImg'
import SelectInput from '@/components/SelectInput'
import ThemeOptions from '@/components/ThemeOptions'
import UploadDnd from '@/components/UploadDnd'
import { useOutput } from '@/store/useStore'
import React from 'react'
function Page() {
const output = useOutput((state:any) => state.output)
return (
<div className='container mx-auto py-10'>
<div className='w-full flex flex-col md:flex-row items:center md:items-stretch gap-20 px-10'>
<div className='flex flex-col items-center gap-8 md:w-1/3 overscroll-auto h-full'>
<div className='flex flex-col gap-5 w-full'>
<h3 className='font-bold text-black text-xl text-start'>Upload a photo of the interior of your home</h3>
<UploadDnd/>
</div>
<div className='flex flex-col gap-5 w-full'>
<h3 className='font-medium text-slate-700 text-sm'>ROOM</h3>
<SelectInput/>
</div>
<div className='flex flex-col gap-5 w-full'>
<h3 className='font-medium text-slate-700 text-sm'>THEME</h3>
<ThemeOptions/>
</div>
<GenerateBtn/>
</div>
<div className='md:w-2/3 flex flex-col mx-auto pb-10'>
<div className='md:flex flex-col gap-5 text-center'>
<h2 className='md:flex hidden text-xl text-black font-semibold'>Your Renders.</h2>
{/* Preview Component */}
<PreviewImg/>
</div>
<div className='flex flex-row w-full gap-5 py-5'>
{output && (
<>
<GenerateBtn />
<DownloadBtn/>
</>
)}
</div>
</div>
</div>
</div>
)
}
export default Page