How do I isolate just Keywords from exif_read_data function? - html

After using the example from this page which talks about exif_read_data:
<?php
echo "images/image.jpg:<br />\n";
$exif = exif_read_data('images/image.jpg', 'IFD0');
echo $exif===false ? "No header data found.<br />\n" : "Image contains headers<br />\n";
$exif = exif_read_data('images/image.jpg', 0, true);
echo "images/image.jpg:<br />\n";
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val<br />\n";
}
}
?>
I got the following result:
images/image.jpg:
Image contains headers
images/image.jpg:
FILE.FileName: image.jpg
FILE.FileDateTime: 1477597739
FILE.FileSize: 65777
FILE.FileType: 2
FILE.MimeType: image/jpeg
FILE.SectionsFound: ANY_TAG, IFD0, EXIF, WINXP
COMPUTED.html: width="640" height="480"
COMPUTED.Height: 480
COMPUTED.Width: 640
COMPUTED.IsColor: 1
COMPUTED.ByteOrderMotorola: 1
IFD0.Orientation: 1
IFD0.Exif_IFD_Pointer: 2122
IFD0.Keywords: Tag_1;Tag_2;Tag_3 <--- info I need
IFD0.UndefinedTag:0xEA1C: �
EXIF.ExifVersion: 0221
EXIF.ColorSpace: 65535
EXIF.UndefinedTag:0xEA1C: �
WINXP.Keywords: ?????????????????
So I just now need to know how to isolate the IFD0.Keywords: Tag_1;Tag_2;Tag_3 part of the results.
How would be able to do this?
(Orginal question was about how to extract meta data from an image and display it on a webpage, which I managed to do, the question evolved to something else. Placing original question details below)
When using Dreamweaver, if I "Insert>Image" it will add the code
<img src="images/Image.jpg" width="400" height="757" />
in automatically, along with the width and height.
I'd like to add in the image metadata automatically too (it obviously won't be part of the <img> tag, it would be output as just text.)
Something like
<img src="images/Image.jpg" width="400" height="757" />
<p> Tags: something; something; something </p>
I would suppose a script would have to be written that would target a folder and pull the metadata out of all the images. I don't even know if that is possible.
How would I be able to do this?

Related

how to make img link to a simple code (Html and Css)

so i want to make all my img links into a simple word/code in html and css
Example:
//Not like this
<img src="https://img1.com">
<img src="https://img2.com">
<img src="https://img3.com">
//I want to do something a little bit more like this instead
value01 = https://img1.com
value02 = https://img2.com
value03 = https://img3.com
<img src="value01">
<img src="value02">
<img src="value03">
I don't know what to do I am new to HTML and CSS
I think you can't do this in html because
The <img> tag is used to embed an image in an HTML page, maybe you can do this in python, instead, you can do this:
<b>
<img src="value1.jpg" alt="Value1" >
</b>
Source :
img tag html
there are two ways I can think of.
::THIS FIRST OPTION ONLY WORKS IF YOU SAVE THE PAGE IN (.PHP) EXTENSION
1° Method => You can create a php file apart, store the links of images in variables like this.
< ? php
$img = 'https : // upload . wikimedia . org /wikipedia/commons/thumb/c/c3/Python-logo-notext . svg/1200px-Python-logo-notext . svg . png';
? >
next, you can call this file in the main page/index.
< ? php
include ". /page/images . php";
? >
< html >
< img src="< ? php echo $img; ? >" alt="" srcset="">
< / html >
2° Method => you can just save the image to a folder easy to target.
create a folder inside the same folder you are accessing your main page.
for example: I created a folder called (img) in the same folder my index.html is found, save the image with a short name.
so to access that image i would call the image like this
< img src="image/img.png" alt="" srcset="">

I want to display individual categories (wordpress) on page, but be able to fully style each category title

I am nearing the end of a project and one of the last things I need to do is take some static html divs and enter category links into them.
The thumbnails have transitions styled into them, so when a user hovers over, the category title will appear over the top of a css mask effect.
http://lukwebdesign.co.uk/projects/chinwe-roy/
The thumbnails are towards the bottom of the home page, so any suggestions as to what to look at would be much appreciated.
TIA.
So there are a few ways to do this(especially depending on your setup) so I'm gonna have to make some assumptions on your site.
I'm assuming you're using default Wordpress posts and categories and not custom post types.
<?php
//Get the terms in the taxonomy "category" and assign it to the variable $terms
$terms = get_terms ('category');
//Use a foreach loop to loop through the terms
//i.e. for each term (e.g. workshop, exhibitions etc) do something
foreach ($terms as $term) {
//html for each category goes here
//e.g. display thumnail/featured image/display category title/link
}
?>
So for example within your foreach loop you could out each category url like so:
<a href="<?php echo site_url() . '/' . $term -> taxonomy . '/' . $term -> slug;?>">
<?php echo $term -> name; ?>
</a>
So for each category you can output a div and style it accordingly.

HTML5 using <video> tag to insert every .mp4 from a directory

I'm trying to make a very basic image/video sharing website. To make things easier on myself, I was wondering if it was possible to mass-include ALL .mp4's from a directory instead of individually adding them. Here is my current doc:
<html>
<body>Under construction.<br>
<video autoplay>
<source src="away.mp4" type="video/mp4">
</video>
</body>
</html>
I don't want to have to manually add a <video> tag for every file, is there a way to add them all at once? Or something like YouTube does, where it shows a thumbnail but opens another page to play it. If there is a way to add the video sources en masse, does it include newly added files?
Maybe something like that
<?php
$dir = './videos';
$video_files = [];
foreach(glob($dir.'/*.*') as $file) {
$file_parts = pathinfo($file);
if ($file_parts['extension'] == "mp4"){
$video_files[] = $file;
}
}
foreach($video_files as $video_file) {
echo "<video autoplay>";
echo "<source src=". $video_file ." type='video/mp4'>";
echo "</video><br/>";
}
?>
or in one loop
<?php
$dir = './videos';
$video_files = [];
foreach(glob($dir.'/*.*') as $file) {
$file_parts = pathinfo($file);
if ($file_parts['extension'] == "mp4"){
echo "<video autoplay>";
echo "<source src=". $file ." type='video/mp4'>";
echo "</video><br/>";
}
}
?>

How to change font in innerHTML new window?

I have to change font in the new window of window.open() because I want to print in receipt printer. I already change the True Type Font Subtitution but it doesn't work . So how can I add css for the new open window ??
here's my code :
<img src="barcode.png" id="barcode">
<script type="text/javascript">
function printImg() {
ImageLink=document.getElementById("barcode").src;
pwin=window.open('','','width=0,height=0');
pwin.document.write("<center><h>My Store<h><br>Ekiosk</center><br>Date : <?php echo date('Y/m/d'); ?><br>Time : <?php echo date('H:i:s'); ?><br>Customer Name: <?php echo $cust['firstname']; ?> <?php echo $cust['lastname']; ?> <br>Total : <?php echo $cust['total']; ?><br><center><img src='" + ImageLink + "'/><br>Thanks For Shopping !</center>");
pwin.print();
pwin.close();
}
</script>
Can anyone help me to change font into font receipt ?
Add a CSS file
<link href="your.css" ... />
Just like you're doing with your pwin.document.write sentence
You should also write a full valid html code in the document.write, including html, title, head and body tags, and put the link inside the head tag, like you use to do in any other page.

Get large artist image from last.fm xml (api artist.getinfo)

This is the xml response from last fm:
<lfm status="ok">
<artist>
<name>Adele</name>
<mbid>1de93a63-3a9f-443a-ba8a-a43b5fe0121e</mbid>
<url>http://www.last.fm/music/Adele</url>
<image size="small">http://userserve-ak.last.fm/serve/34/71796928.png</image>
<image size="medium">http://userserve-ak.last.fm/serve/64/71796928.png</image>
<image size="large">http://userserve-ak.last.fm/serve/126/71796928.png</image>
<image size="extralarge">http://userserve-ak.last.fm/serve/252/71796928.png</image>
<image size="mega">http://userserve-ak.last.fm/serve/_/71796928/Adele+PNG.png</image>
...
I'm trying to echo that large image, but it doesn't return anything...
<?php
$xml = simplexml_load_file("http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=ARTISTNAME&api_key=b25b959554ed76058ac220b7b2e0a026");
$largeimg = $xml->artist->image['large'];
echo '<img src="'.$largeimg.'" />';
?>
If I just put $largeimg = $xml->artist->image; it just grabs that first image (small one). Any idea how I can fix this?
Use PHP's children() function to get the artist node's children:
$artistTag= $xml->artist->children();
$largeImage = $artistTag[5]; // 5 is the index of the Large Image child