473,769 Members | 6,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generating GUID tags with php

Does anyone have any suggestions on generating GUID (Globally Unique
Identifier) tags with php?
They would need to be in the format
4402bd8a-cd51-40ea-99d7-b510e89e344b

Specifically this is for adding accessibility for the PicLens browser
add-on (which uses an .rss file) to some of our photo gallery pages. It
seems to require each thumbnail have an identical GUID tag in both the
html and the rss file.
Feb 26 '08 #1
2 3587
Gary Hasler wrote:
Does anyone have any suggestions on generating GUID (Globally Unique
Identifier) tags with php?
They would need to be in the format
4402bd8a-cd51-40ea-99d7-b510e89e344b

Specifically this is for adding accessibility for the PicLens browser
add-on (which uses an .rss file) to some of our photo gallery pages. It
seems to require each thumbnail have an identical GUID tag in both the
html and the rss file.
If a UUID is acceptable for you (GUID usually means Microsoft's
implementation of UUID; pretty much the same thing, just a 128-bit
unique identifier) then check out this PECL module:

http://pecl.php.net/package/uuid

Jeremy
Feb 26 '08 #2
Jeremy wrote:
>
Gary Hasler wrote:
Does anyone have any suggestions on generating GUID (Globally Unique
Identifier) tags with php?
They would need to be in the format
4402bd8a-cd51-40ea-99d7-b510e89e344b

Specifically this is for adding accessibility for the PicLens browser
add-on (which uses an .rss file) to some of our photo gallery pages. It
seems to require each thumbnail have an identical GUID tag in both the
html and the rss file.

If a UUID is acceptable for you (GUID usually means Microsoft's
implementation of UUID; pretty much the same thing, just a 128-bit
unique identifier) then check out this PECL module:

http://pecl.php.net/package/uuid

Jeremy
Thanks jeremy;
of course as always happens, shortly after posting I stumbled upon the
'perfect' solution: md5().
I can simply use the URL of each picture as string input to the md5
function, which produces a md5 hash (32 character hex). So it is
completely predictable, which I want; yet will NEVER be the same unless
the path to the picture is identical--in which case it will be the same
file!

So I made this function (there may be a more elegant way to do it):
function MakeGUID ($str) {
$h = "-"; //-- HYPHEN
$gMd5 = md5($str);
$guidTag = substr($gMd5,0, 8) . $h . substr($gMd5,7, 4) . $h .
substr($gMd5,11 ,4) . $h . substr($gMd5,15 ,4) . $h . substr($gMd5,19 ,12);
return $guidTag;
}

....and use it in both the PHP file for the gallery page and the RSS
file, giving it the path to each image.
(Jeez PHP is brilliant...the only hard part is getting the right term to
search for. I've never heard of md5!)
Feb 26 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1477
by: Axel Straschil | last post by:
Hello! I was fooling around with creating classes for a module with eval, something like: MyModule.py: class Base: init(self, name): self._name = name
13
2393
by: Michele Simionato | last post by:
What is the recommended way of generating HTML from Python? I know of HTMLGen and of few recipes in the Cookbook, but is there something which is more or less standard? Also, are there plans to include a module for HTML generation in the standard library? I really would like to see some standardization in this area. Michele Simionato
7
1984
by: Mary | last post by:
Hi, I need some assistance with a query. To be honest, I'm not even sure it can be done. I'll try to keep the information limited to only what's relevant to what I have and what I am trying to achieve with this query. I have a table that contains around 100,000 records. For the sake of this discussion, assume just two columns: ID Data
5
6340
by: rcolby | last post by:
Evening, Wondering if someone can point me in the right direction, on how I would compare a system.guid with a system.byte. system.guid (pulled from sql server table with a data type of uniqueidentifier, originally taken from objectGUID from active directory domain)
7
3315
by: Peter | last post by:
Any one have a code snippet that would show me how to: 1. Generate a 24 character 2. Random 3. Alpha Numeric data dump 4. into an array IE.
2
16225
by: Troll | last post by:
Windows XP Pro VS 2005 & C# (I'm fairly new to C# but have doing VB.Net going on 2yrs and VB6 for 5yrs.) I'm using C# to build a custom RSS generator. I'm having trouble building the guid element for each item node in my feed. Some items do not have the "link" node because the description element is the content. So using the "link" as the guid will not work in my case, as some sites suggest and as feedvalidator.org complains when I do not...
6
1814
by: Mike P | last post by:
I am generating 12 random strings and my code works fine when I step through, but when I then let it run without stepping through and populate a listbox with the array I am building, I get the same value repeated 12 times. Here is my code : protected void btnGenerate_Click(object sender, EventArgs e) { string strDomainName = txtDomainName.Text.ToString(); string strEmailAddress = ""; string strEmailAddressComplete = "";
2
2251
by: Prasad | last post by:
This was our earlier design <Product Inventory Info> <Company> <Make>Computer General</Make> <Model>Wizbang 1900</Model> It was later found that <Product Inventory Infohad spaces in between. It was later decided that it has to be of the following format
0
1478
by: shapper | last post by:
Hello, I am trying to define an ObjectDataSource delete parameter. The parameter name is "TagID" and is a Guid: ObjectDataSource1.DeleteParameters.Add(new Parameter("ID", TypeCode.Object)) And the Delete Method defined in the ObjectDataSource is as follows:
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.