Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Image Gallery Management 2

Status
Not open for further replies.
Apr 27, 2006
126
GB
Hi,

Just looking for a point in the right direction as I can't seem to figure out/find the best way to get started.

I wish to create the facility for someone to upload images and descriptions associated to that image to the web server via a form. I wish to do this without a MySQL back end so I figure the best way to hold the information about the whereabouts of the images and their descriptions would be best held in an XML file.

I want this person to be able to add images+descriptions, delete images+descriptions and edit descriptions, possibly add tags.

Could someone please give my metaphorical boat a nudge in the right direction so I can get started with this? Is this the best solution or is there a better option which avoids using a database server?

Many thanks in advance.

p.s. I posted in this section as I guessed it would be the PHP which manages the XML file, but if it would be more suitable in a different section I will be happy to move there :)

________
clueless
 
silly me. the manual is wrong. the function was made available in php 5.2. I will post a drop in. check back in a couple of minutes.
 
apparently so:

Code:
GD Support	enabled
GD Version	bundled (2.0.28 compatible)
FreeType Support	enabled
FreeType Linkage	with freetype
FreeType Version	2.2.1
GIF Read Support	enabled
GIF Create Support	enabled
JPG Support	enabled
PNG Support	enabled
WBMP Support	enabled
XBM Support	enabled

________
clueless
 
just drop this in the global scope somewhere

Code:
[b][COLOR=#0000FF]if[/color][/b][COLOR=#990000](![/color][b][COLOR=#000000]function_exists[/color][/b][COLOR=#990000]([/color][COLOR=#FF0000]'image_type_to_extension'[/color][COLOR=#990000])):[/color]
[b][COLOR=#0000FF]function[/color][/b] [b][COLOR=#000000]image_type_to_extension[/color][/b][COLOR=#990000]([/color][COLOR=#009900]$type[/color][COLOR=#990000])[/color][COLOR=#FF0000]{[/color]
[tab][COLOR=#009900]$extensions[/color] [COLOR=#990000]=[/color] [b][COLOR=#0000FF]array[/color][/b][COLOR=#990000]([/color]
[tab][COLOR=#FF0000]'gif'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'jpeg'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'png'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'swf'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'psd'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'bmp'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'tiff'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'tiff'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'jpc'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'jp2'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'jpx'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'jb2'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'swc'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'iff'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'wbmp'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'xmb'[/color][COLOR=#990000],[/color]
[tab][COLOR=#FF0000]'ico'[/color][COLOR=#990000]);[/color]
[tab][b][COLOR=#0000FF]if[/color][/b] [COLOR=#990000]([/color][b][COLOR=#0000FF]isset[/color][/b][COLOR=#990000]([/color][COLOR=#009900]$extensions[/color][COLOR=#990000][[/color][COLOR=#009900]$type[/color] [COLOR=#990000]-[/color] [COLOR=#993399]1[/color][COLOR=#990000]])):[/color]
[tab][tab][b][COLOR=#0000FF]return[/color][/b] [COLOR=#FF0000]'.'[/color] [COLOR=#990000].[/color] [COLOR=#009900]$extensions[/color][COLOR=#990000][[/color][COLOR=#009900]$type[/color] [COLOR=#990000]-[/color] [COLOR=#993399]1[/color][COLOR=#990000]][/color] [COLOR=#990000];[/color]
[tab][b][COLOR=#0000FF]else[/color][/b][COLOR=#990000]:[/color]
[tab][tab][b][COLOR=#0000FF]return[/color][/b] [COLOR=#FF0000]''[/color][COLOR=#990000];[/color]
[tab][b][COLOR=#0000FF]endif[/color][/b][COLOR=#990000];[/color]
[COLOR=#FF0000]}[/color]
[b][COLOR=#0000FF]endif[/color][/b][COLOR=#990000];[/color]
 
you sir, are awesome sauce... if there was a way of adding 10 stars to each post I would :)


________
clueless
 
no worries. hope it works for you. I have made some mods to the version on the test site to add some formatting and display the image in the edit forms etc.

as said, ideally the image would be rendered to the right resolution before being served, and the rendered version then cached. this is relatively straightforward but do post back if you need help on that.

the advantage in using the image server (action=getImage&imageID=imageID) is that you can (i) protect the images from deep linking my installing them outside of the webroot; (ii) perform authentication before serving the image; (iii) easily move the images around without breaking cached links; (iv) add metadata to the requests like &transform=jpg or &height=xx&width=yy or &maxDim=xx or &size-thumb/mid/full etc etc and then use those query tags to determine how to resample the image before serving.

the disadvantage is primarily server load and SEO.

there are commercial alternative dynamic image transformation services such as elasticera.com, should you/anyone be interested in a high availability solutions.
 
Thanks for the additional info jpadie, very much appreciated. I will have a play tonight but yeah, server load is a concern (it being a VPS) but there will be new images uploaded only occasionally and very few actual hits on the page I expect so I'll monitor it and see how it goes :)

________
clueless
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top