jrImage with original size, width="original" appears in html

SteveX
SteveX
@ultrajam
8 years ago
2,584 posts
Now that we can use "original" as an image size, that can end up as the width of an image, which does not validate:

<img src="http://academicskills.uwe.ac.uk/workbooks/image/micro_image/17957/original/crop=none" width="original" alt="Temporary folder" class="ujdefault iloutline img-responsive center-block">

Quote: error - error Bad value “original” for attribute “width” on element “img”: Expected a digit but saw “o” instead.



--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

updated by @ultrajam: 12/26/16 12:08:05AM
michael
@michael
8 years ago
7,721 posts
There are other widths that are also text values, expect that they would have the same result here no?

eg:
large, xlarge, xxlarge, xxxlarge

CRI: invalid image size - must be one of: 24,xxsmall,40,xsmall,56,72,small,96,icon96,128, icon,196,medium,256,large,320,larger,384,xlarge,512, xxlarge,800,xxxlarge,1280,original

updated by @michael: 09/26/16 06:14:45AM
SteveX
SteveX
@ultrajam
8 years ago
2,584 posts
Hi michael.

No, they don't seem to, if I choose xxxlarge I get width="800". It looks like that is coming from jrImage_get_allowed_image_widths()


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
SteveX
SteveX
@ultrajam
8 years ago
2,584 posts
From jrImage/include.php:
    // See what size we are getting
    if (!isset($_post['_3'])) {
        $_post['_3'] = 'icon';
    }
    $_sz = jrImage_get_allowed_image_widths();
    if (!isset($_sz["{$_post['_3']}"])) {
        if (isset($_post['debug'])) {
            jrCore_notice('CRI', "invalid image size - must be one of: " . implode(',', array_keys($_sz)));
        }
        jrImage_display_default_image($_post, $_conf);
    }
    $_post['width'] = $_sz["{$_post['_3']}"];

For all other image sizes $_sz["{$_post['_3']}"] will be the number, but for original images it will be "original" as that is handled differently in jrImage_get_allowed_image_widths()


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
SteveX
SteveX
@ultrajam
8 years ago
2,584 posts
It's actually the smarty function output I'm seeing, and the image data isnt available there

Looks like I can deal with this in the template by passing in "width=false height=false" for "original" images:
{if $micro_image_display_size == "original"}
	<a href="{$jamroom_url}/{$murl}/image/micro_image/{$_item_id}/original" data-lightbox="images" title="{$micro_title|jrCore_entity_string}">{jrCore_module_function function="jrImage_display" module="ujMicroSite" type="micro_image" item_id=$_item_id size="original" class=$micro_image_class crop=$micro_image_crop alt=$micro_title width=false height=false}</a>{else}
	<a href="{$jamroom_url}/{$murl}/image/micro_image/{$_item_id}/1280" data-lightbox="images" title="{$micro_title|jrCore_entity_string}">{jrCore_module_function function="jrImage_display" module="ujMicroSite" type="micro_image" item_id=$_item_id size=$micro_image_display_size|default:"xxlarge" class=$micro_image_class crop=$micro_image_crop alt=$micro_title}</a>{/if}



--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
michael
@michael
8 years ago
7,721 posts
Fixed in the next version of jrImage 1.4.15

Added a check to make sure the width="" parameter was a number before setting it.
SteveX
SteveX
@ultrajam
8 years ago
2,584 posts
Thanks Michael :)


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

Tags