Seasonal gallery on responsive site

Hi there Walter and all you other geniuses!

I built a responsive website I in Freeway (in Swedish) that has a ”current news” page. There is a foto in the header http://www.smalandsgardar.nu/aktuellt.php

My question is if it is at all possible to have some kind of function that would change the photo automatically accordingly to calendar date? Ideally I would like to rotate image at least 4 times per year (with each season). Looks corny with winter image in the middle of summer on a current news page). The people that manage the site are not capable of editing the picture…I think.

Any suggestions would be very helpful

I have now tried the following method (thanks Walter):

Manually, in Freeway, draw an HTML box on the page where you want to see the picture. Don’t put any content in it or style it in any way. Make note of what name that box has in the Inspector’s Name field. If you leave it at the defaults, it will be item[some number]. You can change it using the Inspector to something reasonable like seasonal_picture or whatever.

On that same page, use the Page / HTML Markup dialog to add a stylesheet reference to the head of the page. You’ll do this by picking the Before picker from the bottom of that dialog, and entering the following line of code:

Make a new blank page where you can cause Freeway to upload your rotating pictures. Just place four (or more) image boxes on the page large enough to cover the empty HTML box on the other page, and fill each one with a picture. Write down the filename of each image (again, found in the Inspector) so you can add it back into your program later. You may want to triple-check what the actual filename is by using Preview In Browser in Freeway to publish that page, then use your browser’s Developer Tools to view the page source, so you can see precisely what Freeway named that file. Usually, you can use the Inspector to figure this out, combining the Name/ID from the left-most tab with the Type from the third-from-the-left (output) tab.

Next, you need to write the seasonal.php program:

<?php $images = array(1 => 'winter.jpeg', 2 => 'winter.jpeg, 3 => 'winter.jpeg', 4 => 'spring.jpeg', 5 => 'spring.jpeg', 6 => 'spring.jpeg', 7 => 'summer.jpeg', 8 => 'summer.jpeg', 9 => 'summer.jpeg', 10 => 'fall.jpeg', 11 => 'fall.jpeg', 12 => 'fall.jpeg'); header('Content-type: text/css'); ?>

#seasonal_picture {
background-image: url(Resources/<?php print($images[date('n')); ?>);
background-size: cover;
background-position: center;
}

You need to use a programmer’s text editor for this last part, because normal word processors will try to do nice things like “curl” the quotation marks, which will break the program. Obviously, adjust the pictures to your seasons and your image names. There’s no way to avoid the duplication, because the date() method doesn’t have a symbol for “what quarter of the year is it?”. Ensure that the names of the files in the array, and the ID of the seasonal_picture box are properly named for the actual pictures and HTML box you created in your Freeway pages.

Finally, to get Freeway to upload that file to where we told it it was in the Page / HTML Markup, you will need to install the Upload Extra Resources Action: Upload Extra Resources - ActionsForge and use it to upload the seasonal.php file into your Resources folder.

Once you do this, and assuming your server is normal and processes PHP scripts such as this without issue, then you should be able to see the whole thing working on your server. Nothing at all will happen in Freeway or if you use Preview in Browser on your Mac. The HTML box will just be a blank area in those cases. On your server, if everything about this is exactly right, you will see the seasonal picture where that box is…

As feared, it is not working. I have poked around to the extent of my ability and I cannot find the error.

Any chance anyone out there could spot it? Christmas is the magic season isn’t it?

Thanx
Sverker

http://www.smalandsgardar.nu/aktuellt.php


freewaytalk mailing list
email@hidden
Update your subscriptions at:

For a start, you have included the stylesheet in your page before all html, not at the “Before ” section. Also, ensure that you have uploaded the seasonal.php file to your Resources folder (using an Action or just an SFTP application). It is currently not there. Once you get those two things taken care of, the final bit that I think I messed up in my first pass at this is that the URLs to the individual images in the generated stylesheet need to lose the Resource/ prefix part. Stylesheets reference the URLs they contain relative to the stylesheet itself, not the page that links to it, so the relative URL to these images (also uploaded to the Resources folder) would just begin with the filename, not the path part.

Walter

On Dec 21, 2018, at 4:34 AM, Zignar email@hidden wrote:

Hi there Walter and all you other geniuses!

I built a responsive website I in Freeway (in Swedish) that has a ”current news” page. There is a foto in the header http://www.smalandsgardar.nu/aktuellt.php

My question is if it is at all possible to have some kind of function that would change the photo automatically accordingly to calendar date? Ideally I would like to rotate image at least 4 times per year (with each season). Looks corny with winter image in the middle of summer on a current news page). The people that manage the site are not capable of editing the picture…I think.

Any suggestions would be very helpful

I have now tried the following method (thanks Walter):

Manually, in Freeway, draw an HTML box on the page where you want to see the picture. Don’t put any content in it or style it in any way. Make note of what name that box has in the Inspector’s Name field. If you leave it at the defaults, it will be item[some number]. You can change it using the Inspector to something reasonable like seasonal_picture or whatever.

On that same page, use the Page / HTML Markup dialog to add a stylesheet reference to the head of the page. You’ll do this by picking the Before picker from the bottom of that dialog, and entering the following line of code:

Make a new blank page where you can cause Freeway to upload your rotating pictures. Just place four (or more) image boxes on the page large enough to cover the empty HTML box on the other page, and fill each one with a picture. Write down the filename of each image (again, found in the Inspector) so you can add it back into your program later. You may want to triple-check what the actual filename is by using Preview In Browser in Freeway to publish that page, then use your browser’s Developer Tools to view the page source, so you can see precisely what Freeway named that file. Usually, you can use the Inspector to figure this out, combining the Name/ID from the left-most tab with the Type from the third-from-the-left (output) tab.

Next, you need to write the seasonal.php program:

<?php $images = array(1 => 'winter.jpeg', 2 => 'winter.jpeg, 3 => 'winter.jpeg', 4 => 'spring.jpeg', 5 => 'spring.jpeg', 6 => 'spring.jpeg', 7 => 'summer.jpeg', 8 => 'summer.jpeg', 9 => 'summer.jpeg', 10 => 'fall.jpeg', 11 => 'fall.jpeg', 12 => 'fall.jpeg'); header('Content-type: text/css'); ?>

#seasonal_picture {
background-image: url(Resources/<?php print($images[date('n')); ?>);
background-size: cover;
background-position: center;
}

You need to use a programmer’s text editor for this last part, because normal word processors will try to do nice things like “curl” the quotation marks, which will break the program. Obviously, adjust the pictures to your seasons and your image names. There’s no way to avoid the duplication, because the date() method doesn’t have a symbol for “what quarter of the year is it?”. Ensure that the names of the files in the array, and the ID of the seasonal_picture box are properly named for the actual pictures and HTML box you created in your Freeway pages.

Finally, to get Freeway to upload that file to where we told it it was in the Page / HTML Markup, you will need to install the Upload Extra Resources Action: Upload Extra Resources - ActionsForge and use it to upload the seasonal.php file into your Resources folder.

Once you do this, and assuming your server is normal and processes PHP scripts such as this without issue, then you should be able to see the whole thing working on your server. Nothing at all will happen in Freeway or if you use Preview in Browser on your Mac. The HTML box will just be a blank area in those cases. On your server, if everything about this is exactly right, you will see the seasonal picture where that box is…

As feared, it is not working. I have poked around to the extent of my ability and I cannot find the error.

Any chance anyone out there could spot it? Christmas is the magic season isn’t it?

Thanx
Sverker

http://www.smalandsgardar.nu/aktuellt.php


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Thanks for getting back to me so quickly.

Strange that the seasonal.php does not list in the resources. I uploaded it with Transmit. It is still there when I view the folder!?

I am not sure if you understand your instructions correctly. I tried and edited the HTML markup

It now reads and I moved it to it’s correct position ( Before ).

I feel a bit stupid, but even more grateful for your help.
Merry X-mas!
S


freewaytalk mailing list
email@hidden
Update your subscriptions at:

Sorry, the change I was mentioning needs to happen in the PHP file, not in the Freeway generated HTML. Did you upload the seasonal.php into the Resources folder, or in the same folder as the HTML file? If the former, it’s not found by my browser there.

Make the PHP code look like this:

<?php
$images = array(1 => 'winter.jpeg', 2 => 'winter.jpeg, 3 => 'winter.jpeg',
                          4 => 'spring.jpeg', 5 => 'spring.jpeg', 6 => 'spring.jpeg',
                          7 => 'summer.jpeg', 8 => 'summer.jpeg', 9 => 'summer.jpeg',
                          10 => 'fall.jpeg', 11 => 'fall.jpeg', 12 => 'fall.jpeg');
header('Content-type: text/css');
?>
#seasonal_picture {
background-image: url(<?php print($images[date('n')); ?>);
background-size: cover;
background-position: center;
}

(removing the Resources/ part)

And then ensure that the link to seasonal.php includes the Resources/ part (in Freeway), and is in the before /head section. Finally, ensure that seasonal.php has been uploaded to the Resources folder.

Walter

On Dec 21, 2018, at 10:53 AM, Zignar email@hidden wrote:

Thanks for getting back to me so quickly.

Strange that the seasonal.php does not list in the resources. I uploaded it with Transmit. It is still there when I view the folder!?

I am not sure if you understand your instructions correctly. I tried and edited the HTML markup

It now reads and I moved it to it’s correct position ( Before ).

I feel a bit stupid, but even more grateful for your help.
Merry X-mas!
S


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

I tried it, but still nothing.

My actual seasonal.php reads as follows:

<?php $images = array(1 => 'winter1.jpeg', 2 => 'winter2.jpeg, 3 => 'winter3.jpeg', 4 => 'winter4.jpeg', 5 => 'spring1.jpeg', 6 => 'spring2.jpeg', 7 => 'spring3.jpeg', 8 => 'spring4.jpeg', 9 => 'summer1.jpeg', 10 => 'summer2.jpeg', 11 => 'summer3.jpeg', 12 => 'summer4.jpeg', 13 => 'fall1.jpeg', 14 => 'fall2.jpeg', 15 => 'fall3.jpeg', 16 => 'fall4.jpeg'); header('Content-type: text/css'); ?>

#seasonalpicture {
background-image: url(<?php print($images[date('n')); ?>);
background-size: cover;
background-position: center;
}

It is (and has always been) uploaded (FTP) as follows: /public_html/Resources/seasonal.php

The page is responsive and also has WebYep CMS on it. Could that be a factor?


freewaytalk mailing list
email@hidden
Update your subscriptions at:

The problem I see immediately is that your quotes are curled in the Link tag you entered in Freeway.

<link rel=”stylesheet” type=”text/css” href=”Resources/seasonal.php” />

should be:

<link rel="stylesheet" type="text/css" href="Resources/seasonal.php" />

The difference is admittedly very subtle, but this is why we use Programmer’s Text Editors when programming.

Walter

On Dec 22, 2018, at 5:26 AM, Zignar email@hidden wrote:

I tried it, but still nothing.

My actual seasonal.php reads as follows:

<?php $images = array(1 => 'winter1.jpeg', 2 => 'winter2.jpeg, 3 => 'winter3.jpeg', 4 => 'winter4.jpeg', 5 => 'spring1.jpeg', 6 => 'spring2.jpeg', 7 => 'spring3.jpeg', 8 => 'spring4.jpeg', 9 => 'summer1.jpeg', 10 => 'summer2.jpeg', 11 => 'summer3.jpeg', 12 => 'summer4.jpeg', 13 => 'fall1.jpeg', 14 => 'fall2.jpeg', 15 => 'fall3.jpeg', 16 => 'fall4.jpeg'); header('Content-type: text/css'); ?>

#seasonalpicture {
background-image: url(<?php print($images[date('n')); ?>);
background-size: cover;
background-position: center;
}

It is (and has always been) uploaded (FTP) as follows: /public_html/Resources/seasonal.php

The page is responsive and also has WebYep CMS on it. Could that be a factor?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

When I correct those problems in my browser, I get a 500 error from the seasonal.php script, which means that there’s a syntax error somewhere within it as well. Looking at the code you posted here in this thread, that’s because there’s a missing single-quote after winter2.jpeg.

Walter

On Dec 22, 2018, at 12:38 PM, Walter Lee Davis email@hidden wrote:

The problem I see immediately is that your quotes are curled in the Link tag you entered in Freeway.

<link rel=”stylesheet” type=”text/css” href=”Resources/seasonal.php” />

should be:

<link rel="stylesheet" type="text/css" href="Resources/seasonal.php" />

The difference is admittedly very subtle, but this is why we use Programmer’s Text Editors when programming.

Walter

On Dec 22, 2018, at 5:26 AM, Zignar email@hidden wrote:

I tried it, but still nothing.

My actual seasonal.php reads as follows:

<?php $images = array(1 => 'winter1.jpeg', 2 => 'winter2.jpeg, 3 => 'winter3.jpeg', 4 => 'winter4.jpeg', 5 => 'spring1.jpeg', 6 => 'spring2.jpeg', 7 => 'spring3.jpeg', 8 => 'spring4.jpeg', 9 => 'summer1.jpeg', 10 => 'summer2.jpeg', 11 => 'summer3.jpeg', 12 => 'summer4.jpeg', 13 => 'fall1.jpeg', 14 => 'fall2.jpeg', 15 => 'fall3.jpeg', 16 => 'fall4.jpeg'); header('Content-type: text/css'); ?>

#seasonalpicture {
background-image: url(<?php print($images[date('n')); ?>);
background-size: cover;
background-position: center;
}

It is (and has always been) uploaded (FTP) as follows: /public_html/Resources/seasonal.php

The page is responsive and also has WebYep CMS on it. Could that be a factor?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Not to keep banging this drum, but I figured this out not by squinting at the code here in FreewayTalk, but by pasting it into a programmer’s text editor. I used TextMate 2, which is free at the moment (it’s been in beta for at least two years), but historically has cost €150, and worth every penny. https://macromates.com For free, you can use BBEdit from https://barebones.com in its “free forever” mode, which replaced their TextWrangler app a while back.

What any programmer’s editor will give you is syntax coloring, which shows you string values (like ‘winter1.jpeg’) in one color, while numbers are another color, and variable declarations like $images are yet another color. This makes it really easy to see where those kinds of mistakes are.

Here’s an example, rendered using GitHub’s Gist service:

See how the colors change in the example.php, compared with the example2.php?

Walter

On Dec 22, 2018, at 1:36 PM, Walter Lee Davis email@hidden wrote:

When I correct those problems in my browser, I get a 500 error from the seasonal.php script, which means that there’s a syntax error somewhere within it as well. Looking at the code you posted here in this thread, that’s because there’s a missing single-quote after winter2.jpeg.

Walter

On Dec 22, 2018, at 12:38 PM, Walter Lee Davis email@hidden wrote:

The problem I see immediately is that your quotes are curled in the Link tag you entered in Freeway.

<link rel=”stylesheet” type=”text/css” href=”Resources/seasonal.php” />

should be:

<link rel="stylesheet" type="text/css" href="Resources/seasonal.php" />

The difference is admittedly very subtle, but this is why we use Programmer’s Text Editors when programming.

Walter

On Dec 22, 2018, at 5:26 AM, Zignar email@hidden wrote:

I tried it, but still nothing.

My actual seasonal.php reads as follows:

<?php $images = array(1 => 'winter1.jpeg', 2 => 'winter2.jpeg, 3 => 'winter3.jpeg', 4 => 'winter4.jpeg', 5 => 'spring1.jpeg', 6 => 'spring2.jpeg', 7 => 'spring3.jpeg', 8 => 'spring4.jpeg', 9 => 'summer1.jpeg', 10 => 'summer2.jpeg', 11 => 'summer3.jpeg', 12 => 'summer4.jpeg', 13 => 'fall1.jpeg', 14 => 'fall2.jpeg', 15 => 'fall3.jpeg', 16 => 'fall4.jpeg'); header('Content-type: text/css'); ?>

#seasonalpicture {
background-image: url(<?php print($images[date('n')); ?>);
background-size: cover;
background-position: center;
}

It is (and has always been) uploaded (FTP) as follows: /public_html/Resources/seasonal.php

The page is responsive and also has WebYep CMS on it. Could that be a factor?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Thanks, all that is very helpful. I have been using TextWrangler for some time. Will check out the others.

I have updated both the page link and the php files but still nothing…

Could image sizes or frame sizes be an issue?

Merry Christmas!
S


freewaytalk mailing list
email@hidden
Update your subscriptions at:

You still have a PHP error in your seasonal.php script. It’s there, almost where it’s supposed to be, but coming back with a 500 error. Check to make sure you uploaded seasonal.php again after adding the single-quote where I indicated.

Things to do, in order, to see how this can be fixed.

  1. In Freeway, move the link to seasonal.php from the Before <head> section to the Before </head> section. That forward-slash is important here.
  2. In the seasonal.php file, at the top of the script, right after the first line (<?php), add these two lines to turn on full debugging:
error_reporting(E_ALL);
ini_set('display_errors',1);

This should let the server tell you why it’s not working as written.

In order to view the errors, visit this URL:

http://www.smalandsgardar.nu/Resources/seasonal.php

…in a browser. You should see all of the issues spelled out for you there.

Once you see what those issues are, and correct them, you can then remove or comment out* those two lines. It’s always best to run in production with debugging off, because failing silently doesn’t give away details about your server that you don’t want others to know.

Walter

*To comment out a line of code (inside the <?php ... ?> delimiters) add two slashes at the beginning of the line.

On Dec 23, 2018, at 3:14 AM, Zignar email@hidden wrote:

Thanks, all that is very helpful. I have been using TextWrangler for some time. Will check out the others.

I have updated both the page link and the php files but still nothing…

Could image sizes or frame sizes be an issue?

Merry Christmas!
S


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

There is a mystery…

I have opened my http://www.smalandsgardar.nu/Resources/seasonal.php with TextMate. I have copied the content and it reads as follows:

<?php $images = array(1 => 'winter1.jpeg', 2 => 'winter2.jpeg', 3 => 'winter3.jpeg', 4 => 'winter4.jpeg', 5 => 'spring1.jpeg', 6 => 'spring2.jpeg', 7 => 'spring3.jpeg', 8 => 'spring4.jpeg', 9 => 'summer1.jpeg', 10 => 'summer2.jpeg', 11 => 'summer3.jpeg', 12 => 'summer4.jpeg', 13 => 'fall1.jpeg', 14 => 'fall2.jpeg', 15 => 'fall3.jpeg', 16 => 'fall4.jpeg'); header('Content-type: text/css'); ?>

#seasonalpicture {
background-image: url(<?php print($images[date('n')); ?>);
background-size: cover;
background-position: center;
}

Is this different from what you find? If so, where is the error?


freewaytalk mailing list
email@hidden
Update your subscriptions at:

This looks okay, but clearly, your server isn’t having anything to do with it. You need to add the two lines that turn on visible debugging output, and see what the actual problem is by visiting it in a browser. Then you can see for yourself what the issue is. Note that the output may be meaningless to you: there is a substantial “learning cliff” to figuring out what ails a server. If you either leave this in debugging mode, or copy and paste the output here and turn debugging back off for your own peace of mind, I will probably be able to figure it out from the message. But then, I’ve been doing this for over 20 years.

Walter

On Dec 24, 2018, at 5:09 AM, Zignar email@hidden wrote:

There is a mystery…

I have opened my http://www.smalandsgardar.nu/Resources/seasonal.php with TextMate. I have copied the content and it reads as follows:

<?php $images = array(1 => 'winter1.jpeg', 2 => 'winter2.jpeg', 3 => 'winter3.jpeg', 4 => 'winter4.jpeg', 5 => 'spring1.jpeg', 6 => 'spring2.jpeg', 7 => 'spring3.jpeg', 8 => 'spring4.jpeg', 9 => 'summer1.jpeg', 10 => 'summer2.jpeg', 11 => 'summer3.jpeg', 12 => 'summer4.jpeg', 13 => 'fall1.jpeg', 14 => 'fall2.jpeg', 15 => 'fall3.jpeg', 16 => 'fall4.jpeg'); header('Content-type: text/css'); ?>

#seasonalpicture {
background-image: url(<?php print($images[date('n')); ?>);
background-size: cover;
background-position: center;
}

Is this different from what you find? If so, where is the error?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

I tried that but nothing at all displayed, either in Safari or in Firefox. Do I need to turn something else on in the browser?


freewaytalk mailing list
email@hidden
Update your subscriptions at:

I turn on JavaScript konsol and get some errors, but neither make sense to me:

  1. Failed to lead resource: the server responded with a status of 500 (internal server error)

When I click the displayed link to the file on the right (http;//www.smalandsgardar.nu/Resources/seasonal.php I get a second error message:

  1. Recourse is empty (my translation from Swedish).

Any idea? (I turn of the debug again)
S


freewaytalk mailing list
email@hidden
Update your subscriptions at:

I ran this on my Mac, and the error is in line 11, where there is a missing ] square bracket.

bad:

background-image: url(<?php print($images[date('n')); ?>);

good:

background-image: url(<?php print($images[date('n')]); ?>);

Fix that, and you should be good. I hadn’t anticipated that the error message would be localized.

You can run PHP scripts on a Mac using the Terminal.app, just navigate in Terminal (using cd) to the spot where the script is saved:

marvin:~ waltd$ cd Desktop/
marvin:Desktop waltd$ php seasonal.php
PHP Parse error:  syntax error, unexpected ')', expecting ']' in /Volumes/eddy/Users/waltd/Desktop/seasonal.php on line 11

Walter

On Dec 25, 2018, at 7:10 AM, Zignar email@hidden wrote:

I turn on JavaScript konsol and get some errors, but neither make sense to me:

  1. Failed to lead resource: the server responded with a status of 500 (internal server error)

When I click the displayed link to the file on the right (http;//www.smalandsgardar.nu/Resources/seasonal.php I get a second error message:

  1. Recourse is empty (my translation from Swedish).

Any idea? (I turn of the debug again)
S


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Super, that was it. Now the image displays, which generates two more questions:

  1. It is a responsive side, on all the pages I have an image wrapper with a image container and the image itself, (pass-through graphic set to 100% width and flexible hight). However, it does not work on this page. I now set the hight to minimum 100px and part of the image displays. How can I show the whole image, and yet retain the responsiveness as on the other pages?

  2. How and when do the images change? I notice that now image nr 12 is showing. (Month 12? In that case I would know how to order them easily)

Thank you so much for super help!!


freewaytalk mailing list
email@hidden
Update your subscriptions at:

On Dec 27, 2018, at 5:05 AM, Zignar email@hidden wrote:

Super, that was it. Now the image displays, which generates two more questions:

  1. It is a responsive side, on all the pages I have an image wrapper with a image container and the image itself, (pass-through graphic set to 100% width and flexible hight). However, it does not work on this page. I now set the hight to minimum 100px and part of the image displays. How can I show the whole image, and yet retain the responsiveness as on the other pages?

A background image cannot influence the height or width of an object it is applied to, so you’ll have to use a different trick to make your image appear to flex like you want. One of the best tricks for this is to work out the percentage difference between the width and the height (the aspect ratio) and then apply that to the padding-bottom of the box, leaving the height at 0 or unspecified. Let’s say your image had a 4:3 ratio, like an old TV. To get that in a flexible image, you would use the following CSS:

.tv {
    width: 100%;
    height: 0;
    padding-bottom: 75%;
}

If you also gave that a color, you’d see that it flexes to show the appropriate height for any given width (depending on the surrounding elements and viewport). If you applied your image to it as the background, using the background-size: cover and background-position: center attributes that I mentioned earlier, you’d see that the otherwise empty box would flex to match the image (even though the background image isn’t what is actually driving that sizing).

http://scripty.walterdavisstudio.com/tv.html

  1. How and when do the images change? I notice that now image nr 12 is showing. (Month 12? In that case I would know how to order them easily)

You got it. The months are converted to the numbers 1 … 12, and that becomes the index of the array holding the image names. Which one shows is down to the values you add to the $images array.

Thank you so much for super help!!

You’re welcome, even for the typos. Now you know something about debugging, too, which is a foundation skill for any sort of programming.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Everything works great now!!

Thanks for your patient support. Very, very helpful. I am almost inspired to go back to doing everything in FW again, now that I know it can be done!

Thanx


freewaytalk mailing list
email@hidden
Update your subscriptions at:

Ooops!! Stopped working again!!! What did I do??


freewaytalk mailing list
email@hidden
Update your subscriptions at:

It looks like you’re missing the file

http://www.smalandsgardar.nu/Resources/winter1.jpeg

When you put that back, the page will look correct again.

You can see all of this, by the way, by turning on the Develop menu in Safari (in Preferences) and then choosing Develop / Show Web Inspector.

Walter

On Dec 27, 2018, at 12:46 PM, Zignar email@hidden wrote:

Ooops!! Stopped working again!!! What did I do??


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options