Commit 1ff678bf authored by jan.koester's avatar jan.koester
Browse files

test

parent 478cfd4f
Loading
Loading
Loading
Loading
+14 −19
Original line number Diff line number Diff line
@@ -377,10 +377,6 @@ extern "C" {
                    val = json_object_get_string(val_obj); if (val) m_height = val;
                }
                if (json_object_object_get_ex(obj, "hidden", &val_obj)) {
                    if (json_object_is_type(val_obj, json_type_string)) {
                        const char *s = json_object_get_string(val_obj);
                        hidden = (s && strcmp(s, "true") == 0);
                    } else {
                    if (json_object_is_type(val_obj, json_type_string)) {
                        const char *s = json_object_get_string(val_obj);
                        hidden = (s && (strcmp(s, "true") == 0 || strcmp(s, "1") == 0));
@@ -388,12 +384,7 @@ extern "C" {
                        hidden = json_object_get_boolean(val_obj);
                    }
                }
                }
                if (json_object_object_get_ex(obj, "m_hidden", &val_obj)) {
                    if (json_object_is_type(val_obj, json_type_string)) {
                        const char *s = json_object_get_string(val_obj);
                        m_hidden = (s && strcmp(s, "true") == 0);
                    } else {
                    if (json_object_is_type(val_obj, json_type_string)) {
                        const char *s = json_object_get_string(val_obj);
                        m_hidden = (s && (strcmp(s, "true") == 0 || strcmp(s, "1") == 0));
@@ -401,12 +392,7 @@ extern "C" {
                        m_hidden = json_object_get_boolean(val_obj);
                    }
                }
                }
                if (json_object_object_get_ex(obj, "fullscreen", &val_obj)) {
                    if (json_object_is_type(val_obj, json_type_string)) {
                        const char *s = json_object_get_string(val_obj);
                        fullscreen = (s && strcmp(s, "true") == 0);
                    } else {
                    if (json_object_is_type(val_obj, json_type_string)) {
                        const char *s = json_object_get_string(val_obj);
                        fullscreen = (s && (strcmp(s, "true") == 0 || strcmp(s, "1") == 0));
@@ -414,7 +400,6 @@ extern "C" {
                        fullscreen = json_object_get_boolean(val_obj);
                    }
                }
                }
                if (json_object_object_get_ex(obj, "custom_css", &val_obj)) {
                    val = json_object_get_string(val_obj);
                    if (val) customCss = val;
@@ -486,6 +471,16 @@ extern "C" {
                    }
                }

                // Append resize query parameters for preview-sized image delivery
                if (realWidth > 0 || realHeight > 0) {
                    std::string sep = (renderSrc.find('?') != std::string::npos) ? "&" : "?";
                    if (realWidth > 0)
                        renderSrc += sep + "w=" + std::to_string(realWidth);
                    sep = (renderSrc.find('?') != std::string::npos) ? "&" : "?";
                    if (realHeight > 0)
                        renderSrc += sep + "h=" + std::to_string(realHeight);
                }

                libhtmlpp::HtmlElement img("img");
                img.setAttribute("src", renderSrc.c_str());
                img.setAttribute("alt", alt.c_str());
@@ -501,8 +496,8 @@ extern "C" {
                std::string effWidth = width;
                std::string effHeight = height;
                if (realWidth > 0 && realHeight > 0) {
                    // If width is a pixel value and height is auto, compute height
                    if (effHeight == "auto" && !effWidth.empty() && effWidth != "auto") {
                    // If width is a pixel value and height is auto/empty, compute height
                    if ((effHeight == "auto" || effHeight.empty()) && !effWidth.empty() && effWidth != "auto") {
                        try {
                            // Check if width is a plain number or ends with "px"
                            std::string wVal = effWidth;
@@ -523,8 +518,8 @@ extern "C" {
                            }
                        } catch (...) {}
                    }
                    // If height is a pixel value and width is auto, compute width
                    else if (effWidth == "auto" && !effHeight.empty() && effHeight != "auto") {
                    // If height is a pixel value and width is auto/empty, compute width
                    else if ((effWidth == "auto" || effWidth.empty()) && !effHeight.empty() && effHeight != "auto") {
                        try {
                            std::string hVal = effHeight;
                            bool isPx = false;