<img src="https://ci3.googleusercontent.com/proxy/B66o0CPxJoqxeKiWDOzMp3n5nsNJ6Tcemt3sHrZ0C5SXqLtZg0hc0z9U8jo=s0-d-e1-ft#http://images/ayay.png">
When I am uploading an image this extra part
OUTPUT:
https://ci3.googleusercontent.com/proxy/B66o0CPxJoqxeKiWDOzMp3n5nsNJ6Tcemt3sHrZ0C5SXqLtZg0hc0z9U8jo=s0-d-e1-ft#
is coming in src part of image.
What it that i am doing wrong?
SEPARATE PHP FILE(From here I fetch (imageame)
function sendimg($id,$filename){
$_SESSION['image_name']=$filename;
}
HTML CODE
<div id="wer">
<img src="images/<?php echo $_SESSION['image_name'].'.png';?>"
</div>
Related
I am trying to make an image hover on a list of galleries, showing the second image of each gallery if it exists.
Some galleries only have one image which is shown as a thumbnail.
The first image is $slider -> url[0] and the second one is $slider -> url[1].
Without using the if statement a problem is aroused: if the second image does not exist it shows a small error image.
I am trying to use an if statement with the required result as follows:
If the second image exists -> show the second image css style (imageexists).
Else (the second image doesn't exist-> show the alternative css style (plusbutton).
Here is the code I used:
<?php $imageexist=url[1]; ?>
<?php if(is_file( $imageexist))
{?>
<div class="image_gallery" style="hover- image: url('<?php echo $slider -> url[0];?>');">
<a href="<?php echo $item->link; ?>">
<div class="imageexists">
<img src="<?php echo $slider -> url[1]; ?>"
itemprop="thumbnailUrl"/>
</div></a>
</div>
<?php }
else { ?> <div class="image_gallery" style="hover- image: url('<?php echo $slider -> url[0];?>');">
<a href="<?php echo $item->link; ?>">
<div class="plusButton">
</div></a>
</div>
<?php }?>
This code does not show any error but it doesn't recognize if the image exists or not, so it shows the alternative (class plusbutton).
How could I make the code check if the second image exists or not?
Thank you very much in advance!
Check paths - this function looks where is directed. Frequently it is not desired directory, but something else.
If directory exists - no errors appears, but your images aren't there.
Check any variable right before is used, start with
<?php
$imageexist=url[1];
print_r($imageexist);
it should be an array with 'path/img_name.ext';
It produces links properly?
/* this is wrong */
<div class="image_gallery" style="hover- image: url('<?php echo $slider -> url[0];?>');">
I'm not sure what effect you wanted, but this style won't work;
I'm using a php frameworks based on (Yii) , my problem is when I insert an html code to my input text after submit I get a plaintext but i want to get is the html format
example
<img src="https://example.com/ex1/ex1.jpg" border="0"> <img src="https://example.com/ex2/ex2.jpg" border="0">
What I get is text with link to the images
<img src="https://example.com/ex1/ex1.jpg" border="0"> <img src="https://example.com/ex2/ex2.jpg" border="0">
my desired output is images not text with link, I used
html_entity_decode(htmlentities($content)); // not working
html_entity_decode($content); // not working
htmlspecialchars_decode($content); // not working too
nl2br($content); // also not working
the output is in the variable content
<div class="content" id="wall_content_<?= $object->getUniqueId(); ?>">
<?= $content; ?> </div>
THANK YOU
In this little snippet of code ,i show how i take the "foto1" column of my database and transfer the value of it to a variable in c# named $foto.
The $foto contains the path of the image corresponding to the product that is showing up. Ive tried to copy and paste the path and ditch out the php part and it works. But when i put it in img src it gives me like the broken image thing.And i cant figure out why it does that.
All help is aprecciated .
Have a nice day :)
<div class="row shop_box-top">
<?php
$ligaBD=odbc_connect('basededadospap','','');
$sql="SELECT * FROM produto WHERE nome_produto LIKE '%ADIDAS%'";
$resultado=odbc_exec($ligaBD,$sql);
?>
<div class="row shop_box-top">
<?php
while (odbc_fetch_row($resultado))
{
$nome = odbc_result($resultado,2);
$preco= odbc_result($resultado,4);
$foto = odbc_result($resultado,9);
?>
<div class="col-md-3 shop_box"><a href="stansmithflatwhite.html">
<img src="<?php echo $foto; ?>" class="img-responsive" alt=""/>
<span class="new-box">
<span class="new-label">Novo</span>
</span>
<div class="shop_desc">
<h3><?php echo $nome; ?></h3>
<span class="actual"><?php echo $preco; ?></span><br>
</div>
</a></div>
<?php }?>
depends of what path contains the $foto var. If is the absolute path, you have to retrive the relative path.
Try also to append an / or an http[s] in front of the path
<img src="/<?php echo $foto;?>">
So it would be : //path/to/photo
As I can see it in your comment, your image paths contain spaces, so a possible solution can be to use urlencode() before echoing them.
Try passing full path to img tag like http://localhost/xyz/images/Cal�ado/Adidas/Homem/Stan Smith/ADIDAS STAN SMITH - RED/ch-adidas-stan-smith-red-5.jpg.
Replace "localhost/xyz" with your website directory path.
I am trying to display image from a blob field of a MySQL table. Looks like I have some sort of error in the following line. As soon as I put "header("Content-type: image/jpeg")" things get messed up and instead of displaying webpage, all source code of the page is displayed.
Please let me know how to correct.
<div class="image" align="left">
<a href="<?php header("Content-type: image/jpeg"); echo $rec['image']; ?>">
<img src="<?php echo $rec['image']; ?>" width="150" border="0"/>
</a>
</div><!-- image -->
You normally don't put the actual image contents in the src= attribute of the image tag. Instead, you point to the URL of an image file.
(There are ways to include the image source directly in the HTML, but it doesn't work consistantly with all browsers, and you still won't have your <a> link working properly.
Instead, the best way to do this is to create a separate PHP file to serve the image.
Your HTML:
<div class="image" align="left">
<img src="myimage.php?key=<?php echo($key) ?>" width="150" border="0"/>
</div><!-- image -->
myimage.php:
<?php
header("Content-type: image/jpeg");
$key = $_GET['key'];
// todo: load image for $key from database
echo $rec['image'];
You're trying to put the image data inline inside the content. The only feasible way to do this is via a Data URI data URI. Something like:
<img src="data:image/jpeg;base64,<?= base64_encode($rec['image']) ?>" width="150" border="0" />
However, what you probably want to do is put it into a separate script. So your HTML would be:
<img src="showimage.php?id=XXX" width="150" border="0" />
And your showimage.php script would be:
<?php
// Get $rec from database based on the $_GET['id']
header('Content-Type: image/jpeg');
echo $rec['image'];
?>
I've done something like that retrieving blob from my database in another way that you may find useful, here is the code example.. see if it suits your needs and if you needed anymore help let me know.
while ($row = mysql_fetch_array($hc_query2)) {
$title = $row['title'];
$text = $row['text'];
$image = $row ['image'];
$output ='<div class="HCInstance"><img src="data:image/jpeg;base64,' . base64_encode($image) . '" alt="High Council" width="100px" height="100px"/>
<div class="HCHeader"><h2>'.$title.'</h2></div><br/><div class="HCDetails"><p>'.$text.'</p></div></div>';
echo $output;
}
I have my site that the users can swap out three products and there are images for each product so rather then doing an ajax call every time the user clicks the button, I wanted to just have the image urls in the html with display none to grab when needed.. so for example, here is my html
<img src="<?php print $product[$selected_product]['product_image']; ?>" width="auto" height="199" alt="" />
</div>
<p style="display:none;" class="image_<?php print $product["standard"]['product_id']; ?>"><?php echo $product["standard"]['product_image']; ?></p>
<p style="display:none;" class="image_<?php print $product["professional"]['product_id']; ?>"><?php echo $product["professional"]['product_image']; ?></p>
<p style="display:none;" class="image_<?php print $product["premium"]['product_id']; ?>"><?php echo $product["premium"]['product_image']; ?></p>
As you can see the one that is displaying is the one selected but if the user selects one of the other images i need to change the src of the image tag...here is my jquery
var image = $(this).parents(".item").find(".image_" + this_id).text();
image = $.trim(image);
console.log(image)
$(this).parents(".item").find(".item-image img").attr("src", image);
but the problem is that the console.log prints out the image url correctly but it sometimes when i click the image doesnt change and i get this error
Image corrupt or truncated: http://posnation.com/shop_possystems/image/data/1B.png
A clearer way to do this would be to render three <img> tags and set their CSS so that they are on top of each other. Then use the jQuery show/hide functions to show the appropriate one.