Re: [tw] Fallback Image File Extensions

2016-03-08 Thread David Allen
More basic version of the problem: Is there some way I can use a fallback
image if the source for an external image is missing?

On Sun, Mar 6, 2016 at 12:56 AM, David Allen 
wrote:

> Well, I thought that worked.  It's now causing a different problem.
>
> I have individual image tiddlers that contain an  tag, pointing to an
> external image and specifying a CSS class.  I then have a series of macros
> that transclude said tiddler within divs that are modified by other CSS
> classes.  Since I wanted the image tiddler to show an image without knowing
> its file extension, I did the following to make an image fallback:
>
> Example Image Tiddler:
> 
> 
> 
> 
> 
>
> I have the following macros that I use with the image tiddler:
>
> \define single_image(target_image)
> 
> <>
> 
> \end
>
> \define basic_image(target_image)
> <$button message="tm-modal" param="$target_image$" class="button_image">
> 
> {{$target_image$}}
> 
> 
> \end
>
> I use the following CSS styles:
>
> .basic_image {
> min-width: 150px;
> }
>
> html .image_container {
> background: #44;
> border-radius: 5px;
> padding: 5px;
> }
>
> .button_image{
> padding: 0px;
> margin: 0px;
> background-color: #44;
> border: none;
> }
>
> .single_image {
> float:right;
> width: 150px;
> margin: 5px;
> }
>
> If both of the object tags are pointing to non-existent files but the
> image tag is pointing to an existent one, this is the result:
>
> https://goo.gl/photos/nyvmxDc2zEaX9sov8
>
> However, if one of the object tags is pointing to an existent file, this
> is the result:
>
> https://goo.gl/photos/bUamzuVp4sAkAYpa8
>
> The first situation is the intended result.  It looks like the 
> tag isn't inheriting the width of the div with the single_image class, and
> I'm not sure how to rectify this problem.
>
>
> On Sat, Mar 5, 2016 at 11:43 PM, David Allen 
> wrote:
>
>> Nevermind, solved it using HTML like this:
>>
>> 
>> 
>> 
>>
>> On Sat, Mar 5, 2016 at 9:57 PM, David Allen 
>> wrote:
>>
>>> I have multiple images that I'm using that are of various types, and I'd
>>> like to create a macro that can easily create the image code I need without
>>> having to switch over to my containing folder and find the image
>>> individually (I use TiddlyDesktop).  Is there some way I can determine if a
>>> file exists from TiddlyWiki before I try to use it as an image's path?
>>>
>>> For example, I wanna generate the following:
>>>
>>> 
>>>
>>> I can generate the line as-is with a macro easily, but I'd like the
>>> macro to change the extension of the filename if the file doesn't exist.
>>> That way, all I have to type is <> and it will
>>> generate the first  line if a file called Race_Vulcan.jpg exists, or
>>> fall back to Race_Vulcan.png, .bmp. etc if it does not.
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "TiddlyWiki" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/tiddlywiki/5CzIAf9hJI4/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> tiddlywiki+unsubscr...@googlegroups.com.
>>> To post to this group, send email to tiddlywiki@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/tiddlywiki.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/tiddlywiki/b43ef77e-18ed-49fd-ba69-6fa616178fc0%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> David Allen
>>
>
>
>
> --
> David Allen
>



-- 
David Allen

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CALaYjLgJqER%2BWVbD8qFOCJaLbR4Ab4HEJiT%2BTd7hgEFJy7EZsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Fallback Image File Extensions

2016-03-05 Thread David Allen
Well, I thought that worked.  It's now causing a different problem.

I have individual image tiddlers that contain an  tag, pointing to an
external image and specifying a CSS class.  I then have a series of macros
that transclude said tiddler within divs that are modified by other CSS
classes.  Since I wanted the image tiddler to show an image without knowing
its file extension, I did the following to make an image fallback:

Example Image Tiddler:






I have the following macros that I use with the image tiddler:

\define single_image(target_image)

<>

\end

\define basic_image(target_image)
<$button message="tm-modal" param="$target_image$" class="button_image">

{{$target_image$}}


\end

I use the following CSS styles:

.basic_image {
min-width: 150px;
}

html .image_container {
background: #44;
border-radius: 5px;
padding: 5px;
}

.button_image{
padding: 0px;
margin: 0px;
background-color: #44;
border: none;
}

.single_image {
float:right;
width: 150px;
margin: 5px;
}

If both of the object tags are pointing to non-existent files but the image
tag is pointing to an existent one, this is the result:

https://goo.gl/photos/nyvmxDc2zEaX9sov8

However, if one of the object tags is pointing to an existent file, this is
the result:

https://goo.gl/photos/bUamzuVp4sAkAYpa8

The first situation is the intended result.  It looks like the  tag
isn't inheriting the width of the div with the single_image class, and I'm
not sure how to rectify this problem.


On Sat, Mar 5, 2016 at 11:43 PM, David Allen 
wrote:

> Nevermind, solved it using HTML like this:
>
> 
> 
> 
>
> On Sat, Mar 5, 2016 at 9:57 PM, David Allen 
> wrote:
>
>> I have multiple images that I'm using that are of various types, and I'd
>> like to create a macro that can easily create the image code I need without
>> having to switch over to my containing folder and find the image
>> individually (I use TiddlyDesktop).  Is there some way I can determine if a
>> file exists from TiddlyWiki before I try to use it as an image's path?
>>
>> For example, I wanna generate the following:
>>
>> 
>>
>> I can generate the line as-is with a macro easily, but I'd like the macro
>> to change the extension of the filename if the file doesn't exist.  That
>> way, all I have to type is <> and it will generate
>> the first  line if a file called Race_Vulcan.jpg exists, or fall back
>> to Race_Vulcan.png, .bmp. etc if it does not.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "TiddlyWiki" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/tiddlywiki/5CzIAf9hJI4/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> tiddlywiki+unsubscr...@googlegroups.com.
>> To post to this group, send email to tiddlywiki@googlegroups.com.
>> Visit this group at https://groups.google.com/group/tiddlywiki.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/tiddlywiki/b43ef77e-18ed-49fd-ba69-6fa616178fc0%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> David Allen
>



-- 
David Allen

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CALaYjLj1OFZJ9fOLG_FG5chyo-VvfpKzeTtiGepqhjgtMB%3DJXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Fallback Image File Extensions

2016-03-05 Thread David Allen
Nevermind, solved it using HTML like this:





On Sat, Mar 5, 2016 at 9:57 PM, David Allen  wrote:

> I have multiple images that I'm using that are of various types, and I'd
> like to create a macro that can easily create the image code I need without
> having to switch over to my containing folder and find the image
> individually (I use TiddlyDesktop).  Is there some way I can determine if a
> file exists from TiddlyWiki before I try to use it as an image's path?
>
> For example, I wanna generate the following:
>
> 
>
> I can generate the line as-is with a macro easily, but I'd like the macro
> to change the extension of the filename if the file doesn't exist.  That
> way, all I have to type is <> and it will generate
> the first  line if a file called Race_Vulcan.jpg exists, or fall back
> to Race_Vulcan.png, .bmp. etc if it does not.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "TiddlyWiki" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/tiddlywiki/5CzIAf9hJI4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> tiddlywiki+unsubscr...@googlegroups.com.
> To post to this group, send email to tiddlywiki@googlegroups.com.
> Visit this group at https://groups.google.com/group/tiddlywiki.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/b43ef77e-18ed-49fd-ba69-6fa616178fc0%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
David Allen

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CALaYjLg66k4DgFPTpKR5ziV_J0a0T04PnjsSsQeMy-V-637d4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.