Welcome Guest, Not a member yet? Register   Sign In
image manipulation, resize adn unique name
#26

[eluser]LynxCoder[/eluser]
[quote author="the_unforgiven" date="1334319014"]also not all files uploaded are going to be one extention some will be jpg some will be gif, png jpeg etc so need to have the ability to do which ever format.[/quote]

Ok, well there are a number of ways in which it can be done. Possibly the easiest (although not the best) is to use strrpos (http://php.net/manual/en/function.strrpos.php) to find the last '.' in the string, so you have something like

Code:
$ext_start = strrpos($filename,'.') - 1;
$filename = substr($filename,$start,$ext_start);

That will give you the filename minus the extension. Then do

Code:
$file_ext = substr($filename,$ext_start,strlen($filename));

That will give you the extension. So store both in the database in separate fields and you can then do what you want to do.




Messages In This Thread
image manipulation, resize adn unique name - by El Forum - 04-12-2012, 03:04 AM
image manipulation, resize adn unique name - by El Forum - 04-12-2012, 07:14 AM
image manipulation, resize adn unique name - by El Forum - 04-12-2012, 08:02 AM
image manipulation, resize adn unique name - by El Forum - 04-12-2012, 08:41 AM
image manipulation, resize adn unique name - by El Forum - 04-12-2012, 08:47 AM
image manipulation, resize adn unique name - by El Forum - 04-12-2012, 08:53 AM
image manipulation, resize adn unique name - by El Forum - 04-12-2012, 09:45 AM
image manipulation, resize adn unique name - by El Forum - 04-12-2012, 11:04 AM
image manipulation, resize adn unique name - by El Forum - 04-12-2012, 04:33 PM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 02:27 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 02:34 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 02:47 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 03:12 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 03:19 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 03:20 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 03:58 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 04:07 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 04:13 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 04:21 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 04:36 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 04:50 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 04:55 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 04:58 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 05:04 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 05:10 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 05:45 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 06:56 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 06:58 AM
image manipulation, resize adn unique name - by El Forum - 04-13-2012, 11:35 AM
image manipulation, resize adn unique name - by El Forum - 04-15-2012, 11:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB