Displaying background image dynamically from database in twig - laravel

I am using laravel and trying to make it possible for users to change the background image of their page using an update form. They upload a pic and the pic is displayed using twig. My code below for getting the user image used for the background pic
$this['userprofile'] = User::with('background_pic')->where('id', $slug)->first();
The background pic is to be rendered in a div using the code below
<div align="center" style="height: 30px; background-image: url('{{ userprofile.avater.path }}');"></d>
the image uploads fine to the backend but not sure how to display it in twig. using the above background-image: url('{{ userprofile.avater.path}}') does not work

In order to render the background-image url from a variable you need to use the asset function.
This twig function resolves the path of your image to a publicly accessible URL.
Example usage:
<div style="background-image: url('{{ asset(userprofile.avater.path) }}');"></d>

Related

Jquery Mobile - How do I show a loading image until all the images on the page are loaded?

I have a webpage - it has a background image.
I only want the page to show when the image has done loading.
I can see that jquery mobile has a "loader" gif, but I cannot work out how to show the loader gif up to and until the image has finished loading.
If the page looks like this
<html>
<body>
<div class="a">
... the rest of the page
</div>
</body></html>
and the class "a" is defined as this
.a {
background-image: url("/WebContent/img/someImageHere.jpg");
background-position: 70% 40%;
}
What would show the loader image (and only the loader image) when the page opens, up to and until the image someImageHere.jpg is finished loading?

Photoset layout not working on tumblr

I am content with my current theme but the photosets are not laying out properly, they are the same width with my photos but say for instance i reblog a photoset with the photos side by side, it wont show up that way on my blog it will show up underneath each other and that is very frustrating since it makes the images blury.
This is my photoset html code. Is there anyway to correct this?
</div>
{/block:Photo}
{block:Photoset}
<div class="entry">
<div class="photosetbox">
{block:Photos}
<img src="{PhotoURL-HighRes}" class="highres">
{/block:Photos}
{block:IndexPage}
<div class="photosett">
{block:Date}
{block:NoteCount}{NoteCountWithLabel} • {/block:NoteCount}{12Hour}:{Minutes} {CapitalAmPm}
{/block:Date}
</div>
<div class="photoset_a">
</div>
{/block:IndexPage}
</div>
Photoset Photos
Your current code specifies that you want each photo from photoset to rendered in the html as an img tag:
{block:Photos}
<img src="{PhotoURL-HighRes}" class="highres">
{/block:Photos}
To render a photoset, you have two options. Either use the built in feature / theme operator. This will give you an iframe with a photoset prebuilt inside it:
{Photoset-700}
Or use a plugin to take your current code and turn it into a photoset.
References
Tumblr Theme Operators - Photosets
Photoset Grid jQuery Plugin

Twitter Bootstrap: Image positioning

I am customizing my website using Twitter Bootstrap. I am trying to insert an image positioned as the top layer, is located slightly "outside of the container", and can responsively resize while staying proportionate / in relation to the other elements. I would like to use position: relative, but the image seems forced into a box within the container. When I use position: absolute, the image displays correctly at first on my web browser, but it does not behave as intended when the screen is resized.
Can anyone help me figure out a good solution to this issue?
HTML: I do not have the image contained within it's own , but is still located within the overall . Here's the code:
<img src="images/hero-babee.png" alt="Babee blowing bubbles." id="babee-bubbles">
CSS: Here's my custom css.
img#babee-bubbles {
z-index: 100;
position: relative;
top: 51%;
left: 7.5%;
}
I'd appreciate any help finding a solution and/or help with my code / syntax. Thanks in advance.
To design responsive website using bootstrap you can use bootstrap layout.
Fluid layout has class "row-fluid" and you can specify width in using class as span.
this structure will be responsive. to test it just resize your browser window.
<div class="row-fluid">
<div class="span2">
<img>....</img>
......
</div>
<div class="span2">
</div>
......
</div>
Bootstrap devide screen size in 12 part. we can use that part by giving
class="span*"
* is no of part.

Facebook "Like" button for image

trying to get my "Like" button to link to Wordpress attached image URL.
Is it possible to "Like" just an image file?
Here's what I have
<?php $large_image_url = wp_get_attachment_url( get_post_thumbnail_id(), 'large'); ?>
<div class="likeButton" style="float: left;"><iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode($large_image_url); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:100px; height:25px"></iframe></div>
Firebug shows it's linking, but pressing like yileds no results to my FB page. Hewlp!
See my answer here: Like Button counts the likes of a PDF but does not actually post the activity?
You can't like a file directly because the file won't serve the metadata Facebook uses to display the 'like' story - you need to like a HTML URL, then include the image on that URL (or redirect users other than Facebook's crawler to the image)

Changing the size of an img container without changing the image size?

Here's an example of my markup:
<li class="tumblr_post tumblr_photo_post">
<img class="tumblr_photo" alt="Testing photo post" src="http://29.media.tumblr.com/tumblr_li5e4zfgrd1qi4tmio1_400.png">
<div class="tumblr_caption">
<p>Testing photo post</p>
</div>
</li>
I'd like to change the size of the image's container without changing the image's size. As it's directly in the flow as an img, how can I do this?
I think your image is not contained into a div container like you are doing with the video on top.
Try to use the following jQuery code to add the img into a div container. You will have to add the jQuery library to your page of course.
$('.tumblr_photo').wrap('<div class="somename" />');

Resources