Tamamlanmış

358650 Image upload problem

When my users upload images I need it to strip out everything but the extension and rename it a numder

For example

upload = [url removed, login to view]

rename = [url removed, login to view]

My script already does this just not all the time I have a lot of broken images. I think it can't recognize certain characters.

Also I have a thumbnail regeneration script that I had modifed because it timed out. It worked fine but now I have many more images it is timing out again. I am currently on a shared hosting account so that is why the problem. I think it needs to broken into smaller tasks.

I want to get the uploads scripts fixed. Then I want to delete all existing thumbnails and thne regenerate them with the fixed regeneration script.

I was wondering if it would be better to have many thumbnail folders instead of 1

Like this

thumbs1

thumbs2

thumbs3

thumbs4

thumbs5

thumbs6

etcetera

that way when the system renames an uploaded image they would not all be in the same folder allowing the regenertion process to happen in smaller batches?

So my regenration scriopt could say regenerate thumb1 or thumbs2 or thumbs3 ...

This is part of the [url removed, login to view] script

// check whether the file exists beforehand, if yes use randomvar in front of filename

mt_srand((double)microtime()*1000000);

$randvar = mt_rand(1,10000000);

settype($randvar,"string");

$extension=explode(".",$realname);

$newfilename = "uploadedimages/" . $randvar.".".$extension[count($extension)-1];// str_replace(" ","_",$realname);

//echo $newfilename;

$shortfname = $randvar.".".$extension[count($extension)-1];// . str_replace(" ","_",$realname);

while ( file_exists($newfilename) != FALSE )

{

$randvar = mt_rand(1,10000000);

settype($randvar,"string");

$newfilename = "uploadedimages/" . $randvar.".".$extension[count($extension)-1];// str_replace(" ","_",$realname);

$shortfname = $randvar.".".$extension[count($extension)-1];// str_replace(" ","_",$realname);

}

This is part of the regenerate script

include_once('[url removed, login to view]');

function main()

{

//$len=mysql_fetch_array(mysql_query("select pwd_len from b2b_config"));

//$pwd_len=$len["pwd_len"];

?>

<script type="text/javascript" src="[url removed, login to view]"></script>

<script type="text/javascript" src="[url removed, login to view]"></script>

<script type="text/javascript">

/*

$step=(integer)$_REQUEST[step];

$count=(integer)$_REQUEST[count];

$current=(integer)$_REQUEST[current];

$limit=((integer)$_REQUEST[limit]>0?(integer)$_REQUEST[limit]:100);

*/

var arr_count =new Array(0,0,0);

var arr_current =new Array(0,0,0);

var limit=100

function Complete(request)

{

var str=[url removed, login to view] ;

var arr=[url removed, login to view]("|");

var ind=parseInt(arr[1]);

if(arr[0]=="count")

{

arr_count[ind]=parseInt(arr[2]);

process(parseInt(arr[1]));

}

if(arr[0]=="process")

{

if(arr_current[parseInt(arr[1])]<arr_count[parseInt(arr[1])])

{

arr_current[parseInt(arr[1])]=arr_current[parseInt(arr[1])]+limit;

process(parseInt(arr[1]));

}

else

{

[url removed, login to view]('but').disabled=false

}

}

if(arr_count[parseInt(arr[1])]>0)

{

var per1=(arr_current[parseInt(arr[1])]*100)/arr_count[parseInt(arr[1])];

var per2=(200*per1)/100

if(per2>200)

{

per2="200";

}

[url removed, login to view]("part"+parseInt(arr[1])).style.width=per2 +"px"

}

[url removed, login to view]("msg"+parseInt(arr[1])).innerHTML=(arr_current[parseInt(arr[1])]>arr_count[parseInt(arr[1])]?arr_count[parseInt(arr[1])]:arr_current[parseInt(arr[1])]) + "/" + arr_count[parseInt(arr[1])];

}

function process(step)

{

new ajax('[url removed, login to view]', {postBody: 'ajax=1&step='+step+"&count="+arr_count[step]+"&current="+arr_current[step]+"&limit="+limit , update: $('asd'), onComplete: Complete});

}

function start()

{

[url removed, login to view]('but').disabled=true

process(0);

process(1)

process(2)

}

</script>

<center>

<div style="display:none" id="asd"></div>

<h1>Click On process to start</h1>

<table>

<tr>

<td>Part 1</td>

<td><div style="width:200px; border:1px solid black; height:20px">

<div id="part0" style="background:red; height:18px;width:0px; padding:1px"></div>

</div></td>

<td id="msg0"></td>

</tr>

<tr>

<td>Part 2</td>

<td><div style="width:200px; border:1px solid black; height:20px">

<div id="part1" style="background:red; height:18px;width:0px; padding:1px"></div>

</div></td>

<td id="msg1"></td>

</tr>

<tr>

<td>Part 3</td>

<td><div style="width:200px; border:1px solid black; height:20px">

<div id="part2" style="background:red; height:18px;width:0px; padding:1px"></div>

</div></td>

<td id="msg2"></td>

</tr>

<tr>

<td></td>

<td colspan="2"><input type="button" name="but" onClick="start()" value="Process" id="but"/> </td>

</tr>

</table>

I can give access to the full script but thought this might be helpful.

Thanks

Beceriler: Her şey Kabul, MySQL, PHP

Daha fazlasını gör: update prototype, the string problem, the prototype part 1, string problem, prototype upload, prototype update, prototype request, prototype part 3, prototype part 2, prototype part 1, prototype lite js, part problem, padding background, no problem part 1, name text image, button onclick php, background padding, str, shared folder, problem with name

İşveren Hakkında:
( 34 değerlendirme ) Peoria, United States

Proje NO: #2104484

Seçilen:

manishbhatias

Hello, I would like to work on this project. Please check PM.

%selectedBids___i_period_sub_7% gün içinde 30%project_currencyDetails_sign_sub_9% %project_currencyDetails_code_sub_10%
(81 Değerlendirme)
4.9