Hey everyone, I’m having a bit of trouble with Google Docs. I’m trying to show an image, but it’s not working. Weirdly enough, it works fine for PDF and DOC files. I’m not sure what I’m doing wrong.
Here’s the code I’m using:
<iframe id="image_viewer" class="display_frame"
src="https://docs.google.com/viewer?url=https://example.com/images/sample.jpg&embedded=true">
</iframe>
Has anyone else run into this issue? Is there a special trick to getting images to show up in Google Docs? Any help would be much appreciated!
hey gizmo, google docs viewer isn’t meant for displaying images directly. it’s mainly for documents. for images, you’d be better off using a direct
tag or hosting on a image sharing platform like imgur. that iframe approach won’t work for jpg files, sry bout that!
I’ve encountered this issue as well. Google Docs viewer is primarily designed for document formats, not standalone images. For displaying images, you’ll need to take a different approach. One effective method is to use a direct
tag in your HTML. Alternatively, you could utilize a cloud storage service like Google Drive or Dropbox, which offer embed options for images. These solutions should resolve your problem without the need for complex workarounds. Remember, simplicity often yields the best results when dealing with web content display.
I’ve run into this issue before, and it can be frustrating. Google Docs viewer isn’t designed to display standalone images. It’s primarily for document formats like PDFs, DOCs, and spreadsheets. For images, you’ll need a different approach.
Instead of using the Google Docs viewer, you could try embedding the image directly using an
tag or, if you need more control, use a lightweight JavaScript image viewer library. Another option is to upload your image to a service like Imgur or Cloudinary, which provide embed codes.
If you absolutely need to use Google’s services, consider uploading the image to Google Drive and using their embed option. It’s not as straightforward as the Docs viewer, but it should work for images. Hope this helps!