help - having a big problem!!!
Moderator: General Moderators
help - having a big problem!!!
Hi,
i'm having a couple of major problems with a site i'm trying to develop and wondered if someone could help me out.
Basically i am developing a cms for auto dealer based on an open source system http://car-dealer-website.org/
The site i am working on is currently at http://www.whitenoisedesign.co.uk and the admin panel is at http://www.whitenoisedesign.co.uk/admin/index.php username: admin password: test
I want to alter the functionality of the site slightly from the original but am having problems getting it working correctly. I want to make the following 2 changes to the script.
1. When the user uploads a car the image becomes distorted when scaled down. I have tried to add some code to resize the thumbnail but with no joy. you can see the problem here http://www.whitenoisedesign.co.uk/details.php?id=7
2. I would also like to allow the user to be able to add up to 10 additional images at once, rather than having to add them one at a time as a present like it is now here. http://www.whitenoisedesign.co.uk/admin ... =add&car=7
any help in this would be very much appreciated and i thank you for taking the time to look at this problem
all the files can be found here http://www.whitenoisedesign.co.uk/autodealerwebsite.zip
many thanks
i'm having a couple of major problems with a site i'm trying to develop and wondered if someone could help me out.
Basically i am developing a cms for auto dealer based on an open source system http://car-dealer-website.org/
The site i am working on is currently at http://www.whitenoisedesign.co.uk and the admin panel is at http://www.whitenoisedesign.co.uk/admin/index.php username: admin password: test
I want to alter the functionality of the site slightly from the original but am having problems getting it working correctly. I want to make the following 2 changes to the script.
1. When the user uploads a car the image becomes distorted when scaled down. I have tried to add some code to resize the thumbnail but with no joy. you can see the problem here http://www.whitenoisedesign.co.uk/details.php?id=7
2. I would also like to allow the user to be able to add up to 10 additional images at once, rather than having to add them one at a time as a present like it is now here. http://www.whitenoisedesign.co.uk/admin ... =add&car=7
any help in this would be very much appreciated and i thank you for taking the time to look at this problem
all the files can be found here http://www.whitenoisedesign.co.uk/autodealerwebsite.zip
many thanks
feyd | Please use
and i think this is the code which uploads the files[/syntax]
basically what i need to do is get the xml output to duplicate 10 timesto allow 10 images to be uploaded at once, but i have tried several methods biut with no luck.
many thanks
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
The output is diplayed via the xml below:
[syntax="xml"]<form>
<title>Add, edit or remove additional images</title>
<action>index.php?sub=photos&action=store</action>
<name>edit</name>
<width>540</width>
<encoding>multipart/form-data</encoding>
<formtag>true</formtag>
<border>true</border>
<buttons>
<set>
<footer>true</footer>
<header>true</header>
</set>
<return onclick="" button="return" >
<location>index.php?sub=auto&action=details&car_id={CAR}</location>
</return>
<save onclick="" button="saveall">
<location>javascript:document.forms[0].submit();</location>
</save>
</buttons>
<redirect>index.php?sub=auto&action=details&car_id={CAR}</redirect>
<fields>
<id type="hidden" />
<car type="hidden" default="$_GET[car]" action="eval" />
<title type="textbox" size="30" required="true" validate="A:1:200">
<title>Title</title>
</title>
<image type="image" adminwidth="150" adminheight="113" path="../upload/" absolute="false" editable="true">
<file default="photo_" field="id" ext=".jpg" />
<title>Image</title>
<error>No image currently available.</error>
</image>
</fields>
</form>Code: Select all
case "upload":
$file = true;
case "image":
if ($field["editable"] != "false") {
//adding the editable area to form
$field["web_checked"] = $values["values"][$field["name"] . "_radio_type"] ? "checked" : "";
$field["client_checked"] = $values["values"][$field["name"] . "_radio_type"] ? "" : "checked";
$field["web_link"] = $values["values"][$field["name"] . "_upload_web"] ? $values["values"][$field["name"] . "_upload_web"] : "http://";
$field["file_name"] = $values["values"][$field["name"] . "_file"];
$field["rem_disabled"] = $values["values"][$field["name"] . "_temp"] || $values["values"][$field["name"] . "_temp"] || $values["values"][$field["name"]] ? "" : "disabled";
$image["editable"] = $this->templates->blocks[$file ? "uploadedit" : "imageedit"]->Replace($field);
}
if ($file) {
if (is_file($_CONF["path"] . $_CONF["upload"] . "tmp/" . $values["values"][$field["name"] . "_temp"])) {
//show the <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> image
$image["preview"] = $this->templates->blocks["fileshow"]->Replace(
array(
"name" => $_CONF["url"] . $_CONF["upload"] . "tmp/" . $values["values"][$field["name"] . "_file"],
"src" => $_CONF["url"] . $_CONF["upload"] . "tmp/" . $values["values"][$field["name"] . "_temp"]
)
);
} else {
$file_name = $_CONF["path"] . $_CONF["upload"] . ($field["path"] ? $field["path"] : $field["file"]["path"]) . $field["file"]["default"] . $values["values"][$field["file"]["field"]] . $field["file"]["ext"];
$file_url = $_CONF["url"] . $_CONF["upload"] . ($field["path"] ? $field["path"] : $field["file"]["path"]) . $field["file"]["default"] . $values["values"][$field["file"]["field"]] . $field["file"]["ext"];
if (/*$values["values"][$field["name"]] && */file_exists($file_name)) {
$image["preview"] = $this->templates->blocks["fileshow"]->Replace(
array(
"name" => $values["values"][$field["name"] . "_file"] ? $values["values"][$field["name"] . "_file"] : $field["file"]["default"] . $values["values"][$field["file"]["field"]] . $field["file"]["ext"],
"src" => $file_url
)
);
} else
$image["preview"] = $field["error"] ? $field["error"] : "No file uploaded.";
}
} else {
if (is_file($_CONF["path"] . $_CONF["upload"] . "tmp/" . $values["values"][$field["name"] . "_temp"])) {
//show the <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> image
$image["preview"] = $this->templates->blocks["imageshow"]->Replace(
array(
"width" => $field["adminwidth"],
"height" => $field["adminheight"],
"src" => $_CONF["url"] . $_CONF["upload"] . "tmp/" . $values["values"][$field["name"] . "_temp"]
)
);
} else {
//hm ... making a small trick to keep the image even if that was an failed adding,
//this sux becouse if the add process is not completed then i get crap in the temp folder.
if ($values["values"][$field["name"]] && file_exists($_CONF["path"] . $_CONF["upload"] . $field["path"] . $field["file"]["default"] . $values["values"][$field["file"]["field"]] . $field["file"]["ext"])) {
$image["preview"] = $this->templates->blocks["imageshow"]->Replace(
array(
"width" => $field["adminwidth"],
"height" => $field["adminheight"],
"src" => $_CONF["url"] . $_CONF["upload"] . $field["path"] . $field["file"]["default"] . $values["values"][$field["file"]["field"]] . $field["file"]["ext"]
)
);
} else {
//checking if there exists a default image
if ($field["default"]) {
$image["preview"] = $this->templates->blocks["imageshownolink"]->Replace(
array(
"width" => $field["adminwidth"],
"height" => $field["adminheight"],
"src" => $_CONF["url"] . $_CONF["upload"] . $field["path"] . $field["default"]
)
);
} else
//return an error from xml
$image["preview"] = $field["error"] ? $field["error"] : "No image curently available.";
}
}
}
$image["temp"] = $values["values"][$field["name"] . "_temp"];
$this->templates->blocks["image"]->Replace($image , false);
$current_field = $this->templates->blocks["image"]->EmptyVars();
//if the field hs description then i add the valign code
$current_field_extra = $field["description"] ? $this->templates->blocks["TopAlign"]->output : "";
break;many thanks
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]hi
sorry, yes i know and i dont expect anyone to rewrite it for me. I just be grateful if someone could give me a pointer as to what i need to do. I have tried to write a loop to print out the code 10 x's but nothing seems to be working.
i will post some of the attempts i have made to see if you can see where i'm going wrong.
thanks.
sorry, yes i know and i dont expect anyone to rewrite it for me. I just be grateful if someone could give me a pointer as to what i need to do. I have tried to write a loop to print out the code 10 x's but nothing seems to be working.
i will post some of the attempts i have made to see if you can see where i'm going wrong.
thanks.
feyd | Please use
will i need to increment the fields and teh id etc to make this work properly?
thanks
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
i have tried to duplicate the xml which prints out the upload form 10 times but it seems to just overwrite itself. i'm not very familiar with xml so is it possible to duplicate an area of code and have it print out without writing over itself. it was this part i duplicated:
[syntax="xml"]<fields>
<id type="hidden" />
<car type="hidden" default="$_GET[car]" action="eval" />
<title type="textbox" size="30" required="true" validate="A:1:200">
<title>Title</title>
</title>
<image type="image" adminwidth="150" adminheight="113" path="../upload/" absolute="false" editable="true">
<file default="photo_" field="id" ext=".jpg" />
<title>Image</title>
<error>No image currently available.</error>
</image>
</fields>thanks
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]