dompdf one image not displaying - php

I am running a while loop and generating a var called $features
while(blah) {
$features .= "<li><img src='/srv/sitename.com/htdocs/images/sid.gif'> $features_bullet_text</li>";
} // THIS LOOP WORKS FINE, PULLING CONTENT, IMAGE DOES NOT SHOW
Then I am putting this var inside the code below. The content being pulled works fine but the image does not display. The image marked below "IMAGE SHOWS UP" is there when the PDF is generated along with several others but for some reason the one I tacked on to the front of my <li> will not show up. Anyone have any suggestions?
It is not permissions, the file path is correct on the server but I need to generate this mysql/loop of <li>s prior to putting into this PDF. Hope this makes sense to someone.
$html = <<<EOF
PROPER HTML ABOVE
<!-- IMAGE SHOWS UP -->
<img src="/srv/sitename.com/htdocs/images/ordering_information.jpg">
<!-- IMAGE DOES NOT SHOW UP IN LI -->
<ul>
$features
</ul>
PROPER HTML BELOW
EOF;
All features working properly. Only the image inside the <li> will not show. Also I have tried using double quotes and escaping them and that did not work. Tried no quotes around image and currently have single quotes in place.

According to this page, the GD library may need to be installed to display GIF images.
If you can't install that, try replacing your GIF with a JPG or PNG and see if that solves things.

Related

Is this correct to read the content of image file by using PHP and output through the <img> tag?

Summary
I am trying to use the IMAP functions to fetch the email attachments. Also, I am trying to fetch the inline images and show them out to the screen by using <img> tag. In order not to occupy so much server space, I decided not to save those fetched inline images as files on the server and show them on the screen. My decision is that after fetching the content of one of the inline image, print it out by using echo function, then use <img> tag to show the printed content out one by one. The code may look like the following part:
Codes
show-inline-image.php
<?php
...(omit)...
echo $image_content; //The variable $image_content is the content of fetched inline image
?>
show-image.php
<?php
...(omit)...
echo "<img src='show-inline-image.php'>"; //Show the image
...(omit)...
?>
Though this way could print the inline images out successfully. But I am not sure whether it is alright to show the inline images in this way. Is there any other better ways to impove it?
P.S. The output result of show-inline-image.php may look like the image below:

Some linked images not working in HTML

I have PHP code that generates HTML code which makes a grid of images. The images are taken from links that are generated for each new image, I also add 133x100 at the end of the image link to resize it on the page. My problem is that a seemingly random selection of images won't display, and I just get a broken image symbol. For example:
This is a link to an image that is generated on my page and is displayed.
This is a link to an image that will not be displayed.
I am only allowed to post 2 links, but removing the %20.%20/133x100 from the end of the last link will show what the picture should be.
Here is the part of the code for the image source:
function display_images(){
//This cycles through each image and displays it as HTML
while($row = $item->fetch()){
Echo "`<img src= '$link[Image_Link] . /133x100' />`"
}
}
It is then called here in a class which puts the images in a grid:
<ul class="rig columns-4">
<?php
display_images();
?>
</ul>
Seemingly about every 2/20 images won't work, and seeing all the links are in the same format, I don't understand why they won't work, and it just seems random.
EDIT: I have noticed that the links that work have 62fx62f at the end of them before the added %20.%20/133x100. If I add it to the raw link in the right place, it makes the image work. But using that generated link, the image still won't load on the page. So using a link with a working image will not work on the page. (This is the same with the raw link without %20.%20/133x100, that links to an image but also won't work on the website)
When visiting the links, the urls look like this:
http://www.example.com/image/randomcharacters%20.%20/133x100
The links work without the %20.%20 at the right dimensions, like so:
http://www.example.com/image/randomcharacters/133x100
This leads me to believe that it may work if you try using the following for the image source instead:
<img src= '$link[Image_Link]/133x100' />
The full code would look like this, for the while function:
while($row = $item->fetch()){
echo "<img src= '" . $link['Image_Link'] . "/133x100' />";
}
I am not aware of steamcommunity much but from the looks of it, i think you should try this.
Instead of putting
. /133x100
Use
/133fx100f
So your URLs would be
while($row = $item->fetch()){
echo "<img src= '" . $link['Image_Link'] . "/133fx100f' />";
}
Just did some trial and error and found out. No explanations for this though!!

CSS Floating issue with text and images

I'm using php to display image(s) and accompanying text (This is done using a WHILE loop) See below:
While (true) {
echo "
<h2>$post_title</h2>
<img src ='new_images/$post_image' width='200' height='200'/> // Image
<div>$post_content</div> "; // Text
}
I have used CSS to float the image left. Therefore,the accompanying text appears to the right of the image.
However, the second image and accompanying text is NOT sitting below the first. It's trying to force itself into any space to the right of the first image
Can I use CSS to ensure the images are stacked??
I hope that above makes sense?
add clear:both to your images and it should work just fine

adding a background-image to body in a cakephp layout with jQuery

I'm using cakephp 2 and I'm trying to allow my users to upload an image which is then used as the background for their page.
I have the images uploading fine and saving to a (webroot)files/User/$userid/$bodybgimage. I've also got the name of the image in the database.
Trouble is I want because I don't know in advance what user id is going to be requesting their background image I can't put their background in the stylesheet, so I'm trying to get it added in the default layout. I've tried to add with jquery: (the image filename is in $bodybgimage)
<?php if(!$bodybgimage == '') {?>
$('body').css('background-image', 'url('<?php echo '../files/User/'.$userId.'/'.$bodybgimage; ?>')');
<?php }?>
But this seems to just remove everystyle I had for the body!
I also tried doing adding it straight to the body tag like so:
<body<?php if(!$bodybgimage == '') echo ' style="background-image:url(../files/User/'.$userId.'/'.$bodybgimage.')"';?>>
But again to no avail. Can anyone help me out. I know the image and all's there because if I put the background-image style in the stylesheet the image pops up ok. There must be a sensible way to do this that I'm missing. Plz help!
Please can you try to omit the "../" before the files as i assume that your images founded in a folder named files beside your script not ?

PHP insert include into dynamic text - two dynamic elements, will it still execute?

I have an interesting question, or atleast I think it is.
I have this website http://21-card-games.com/best/casino-reviews/casino-casino-titan.asp. You will see the image and below it the content.
Is it possible to combine the image with the text and left align the image and make the text flow next to the image.
The pages are all dynamically created, The content on the page is a variable that I import from a mysql db...
Here is some of the coding:
<div id="yui-main"><div class="yui-b"><?php echo $g_page_content2 ?><br />
<?php include($_SERVER['DOCUMENT_ROOT'].'/includes/standard_images_screenshot_1.php');?><?php echo $g_content_text1 ?>
<?php /* This is the second banner for this page */ include($_SERVER['DOCUMENT_ROOT'].'/includes/banners/'.$row_rs_settings['g_sites_affiliate_ads2'].'.php');?></div>
The $g_content_text1 is the variable that pulls in the text, and the '/includes/standard_images_screenshot_1.php' is the image. The include image file is part of a script that creates the image on the fly (imagick).
However this is more or less what I where thinking:
to create a regex that replaces the first occurance of <p> with this include($_SERVER['DOCUMENT_ROOT'].'/includes/banners/'.$row_rs_settings['g_sites_affiliate_ads2'].'.php' but I am not sure if the php will still execute if I do that...
Any ideas on how I can accomplish this would be appreciated.
I don't get it.
Why you want to create a regexp to let the text flow on the left of the image?
This is a css issue.
Just add float:left to the image.

Categories