Tuesday, October 11, 2022

[FIXED] How to dynamically update a page with images generated via php GD

Issue

Currently I am dynamically generating 1-(N) images via php GD based on user form input, and then posting into an iframe, that displays the image.

But theres a couple of problems:

  1. Iframes seems to be a drag when styling.
  2. The user dont seem to be able to "rightclick->saveas" the images properly when in iframes.

So are there any better methods for doing this?


Solution

Use a fixed size div element with overflow: scroll set on it.

For example:

#container {
    width: 600px;
    height: 300px;
    overflow-y: scroll; //vertical scrolling only
}

It behaves in the same manner as an iframe, but allows you better control of both content via javascript and styling via CSS.



Answered By - Rory McCrossan
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.