Auch zu kleine Bilder werden vergrößert (unter max. Größe)

Ifthatsthewayitis

Aktives Mitglied
20. Dezember 2006
24
0
Hallo,

erstmal ein großes Lob für das super Programm. Ich verwende es mit XT-C in Version 3.04 SP2.1.

Ich habe ein Problem und zwar verwende ich manchmal auch Bilder die unter die maximalen Bildgrößen fallen, doch auch diese Bilder werden vergrößert und so entstehen Bilder die total gestretscht sind und unleserlich. Wie kann man verhindern das eazySales diese Bilder auch vergrößert? Ich dachte das eazySales die image manipulation von Xt-C durchführen lässt, aber anscheinend ist das nicht der Fall. Ich denke die verantwortliche Datei ist dbeS/KategoriePict.php, doch wie müsste man sie ändern bzw. muss direkt was an eazySales geändert werden, damit die Bilder die unter die maximale Größe fallen einfach direkt hochgeladen werden ohne nochmal vergrößert zu werden?

Vielen Dank schon mal für eure Hilfe!
 

Ifthatsthewayitis

Aktives Mitglied
20. Dezember 2006
24
0
Kann eigentlich nicht sein, weil ich habe eine Veränderung bei XT-C eingebaut die die kleinen Bilder auslässt und habe das auch getestet per XT-C Admin und es funktioniert, aber eazySales erstellt weiterhin die Bilder so das sie doch gestretscht werden... also wer übernimmt die Bildmanipulation denn nun, weil die von XT-C macht es eigentlich so wie ich will aber eazySales nicht!?
 

Thomas Lisson

Administrator
Mitarbeiter
24. März 2006
15.574
300
Köln
Hallo,

der Connector legt das Original Bild ab und erstellt alle kleineren Formate nach den Größenangaben, die man in XTC angibt.


dbeS/setArtikelbild.php ist dafür zuständig.
 

Ifthatsthewayitis

Aktives Mitglied
20. Dezember 2006
24
0
Gibt es vielleicht die Möglichkeit dort etwas einzubauen damit die Bilder die zu klein für diese Werte sind, nicht noch weiter vergrößert werden und einfach in der vorliegenden Größe bleiben?

Das wäre sehr hilfreich für mich!
 

Ifthatsthewayitis

Aktives Mitglied
20. Dezember 2006
24
0
Vielen Dank für die Hilfe, es gibt mit der Version aber noch ein Problem und zwar werden jetzt nur noch popup_images für die Bilder erzeugt die größer als die Werte sind und die anderen werden einfach ignoriert, also auch nicht hochgeladen oder als Orginal gespeichert. Wenn er jetzt noch die Orginale von den Bildern hochlädt die noch unter den max-Werten ist, dann funktioniert es perfekt!

Danke schonmal!
 

Ifthatsthewayitis

Aktives Mitglied
20. Dezember 2006
24
0
Und ich denke ich habe die Lösung gefunden:

Code:
					//popup
					$cur_query = xtc_db_query("select configuration_value from configuration where configuration_key=\"PRODUCT_IMAGE_POPUP_WIDTH\"");
					$width_obj = mysql_fetch_object($cur_query);
					$cur_query = xtc_db_query("select configuration_value from configuration where configuration_key=\"PRODUCT_IMAGE_POPUP_HEIGHT\"");
					$height_obj = mysql_fetch_object($cur_query);
					$new_width = 300;
					if ($width_obj->configuration_value>0)
						$new_width = $width_obj->configuration_value;
					$new_height = round ($new_width / $ratio);
					if ($new_height>$height_obj->configuration_value)
					{
						$new_height=$height_obj->configuration_value;
						$new_width = round ($new_height * $ratio);
					}


					if ($new_width<$width && $new_height<$height)
					{
						$image_p = imagecreatetruecolor($new_width, $new_height);
						imagecopyresampled($image_p, $im, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
						imagejpeg($image_p, DIR_FS_CATALOG_POPUP_IMAGES.$bildname, 80);
						chmod (DIR_FS_CATALOG_POPUP_IMAGES.$bildname, 0644);
					} else {	
					$image_p = imagejpeg($image_p, DIR_FS_CATALOG_POPUP_IMAGES.$bildname, 80);
					chmod (DIR_FS_CATALOG_POPUP_IMAGES.$bildname, 0644);
					}
(also die letzte else Schleife ist von mir)

Jedenfalls funktioniert es jetzt damit bei mir. Vielleicht sagen Sie nochmal dazu ob das eine gute Lösung ist?
 

Thomas Lisson

Administrator
Mitarbeiter
24. März 2006
15.574
300
Köln
Hallo,

ich habe da etwas übersehen.
So sollte es perfekt laufen:

Code:
<?php
/**
 * eazySales_Connector/dbeS/setArtikelBild.php
 * Synchronisationsscript
 * 
 * Es gelten die Nutzungs- und Lizenzhinweise unter [url]http://www.jtl-software.de/eazysales.php[/url]
 * 
 * @author JTL-Software <thomas@jtl-software.de>
 * @copyright 2006, JTL-Software
 * @link [url]http://jtl-software.de/eazysales.php[/url]
 * @version v1.05 / 22.12.06
*/

require_once("syncinclude.php");

$return=3;
$_POST['userID'] = $_POST['euser'];
$_POST['userPWD'] = $_POST['epass'];
if (auth())
{
	$return=0;
	//nur BildNr 1 wird berücksichtigt
	if (intval($_POST['kArtikelBild'])>0 && $_FILES['bild'])
	{
		//hol Anzahl unterstützter Bidler 
		$cur_query = xtc_db_query("select configuration_value from configuration where configuration_key=\"MO_PICS\"");
		$additional_pics = mysql_fetch_object($cur_query);
		
		//hol products_id
		$products_id = getFremdArtikel(intval($_POST['kArtikelBild']));	
		if ($products_id>0)	
		{
			$bildname=$products_id."_".(intval($_POST['nNr'])-1).".jpg";
			if (intval($_POST['nNr'])==1 || $additional_pics->configuration_value>=intval($_POST['nNr'])-1)
			{
				move_uploaded_file($_FILES['bild']['tmp_name'],DIR_FS_CATALOG_ORIGINAL_IMAGES.$bildname);
				chmod (DIR_FS_CATALOG_ORIGINAL_IMAGES.$bildname, 0644);
			
				$im = @ImageCreateFromJPEG (DIR_FS_CATALOG_ORIGINAL_IMAGES.$bildname);
				if ($im)
				{	
					//bild skalieren
					list($width, $height) = getimagesize(DIR_FS_CATALOG_ORIGINAL_IMAGES.$bildname);
					$ratio = $width / $height;
					
					//thumbnail
					$cur_query = xtc_db_query("select configuration_value from configuration where configuration_key=\"PRODUCT_IMAGE_THUMBNAIL_WIDTH\"");
					$width_obj = mysql_fetch_object($cur_query);
					$cur_query = xtc_db_query("select configuration_value from configuration where configuration_key=\"PRODUCT_IMAGE_THUMBNAIL_HEIGHT\"");
					$height_obj = mysql_fetch_object($cur_query);
					$new_width = 120;
					if ($width_obj->configuration_value>0)
						$new_width = $width_obj->configuration_value;
					$new_height = round ($new_width / $ratio);
					if ($new_height>$height_obj->configuration_value)
					{
						$new_height=$height_obj->configuration_value;
						$new_width = round ($new_height * $ratio);
					}
					if ($new_width<$width && $new_height<$height)
					{
						$new_width=$width;
						$new_height=$height;
					}
					$image_p = imagecreatetruecolor($new_width, $new_height);
					imagecopyresampled($image_p, $im, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
					imagejpeg($image_p, DIR_FS_CATALOG_THUMBNAIL_IMAGES.$bildname, 80);
					chmod (DIR_FS_CATALOG_THUMBNAIL_IMAGES.$bildname, 0644);
					
					
					//info
					$cur_query = xtc_db_query("select configuration_value from configuration where configuration_key=\"PRODUCT_IMAGE_INFO_WIDTH\"");
					$width_obj = mysql_fetch_object($cur_query);
					$cur_query = xtc_db_query("select configuration_value from configuration where configuration_key=\"PRODUCT_IMAGE_INFO_HEIGHT\"");
					$height_obj = mysql_fetch_object($cur_query);
					$new_width = 200;
					if ($width_obj->configuration_value>0)
						$new_width = $width_obj->configuration_value;
					$new_height = round ($new_width / $ratio);
					if ($new_height>$height_obj->configuration_value)
					{
						$new_height=$height_obj->configuration_value;
						$new_width = round ($new_height * $ratio);
					}
					if ($new_width<$width && $new_height<$height)
					{
						$new_width=$width;
						$new_height=$height;
					}
					$image_p = imagecreatetruecolor($new_width, $new_height);
					imagecopyresampled($image_p, $im, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
					imagejpeg($image_p, DIR_FS_CATALOG_INFO_IMAGES.$bildname, 80);
					chmod (DIR_FS_CATALOG_INFO_IMAGES.$bildname, 0644);
													
					//popup
					$cur_query = xtc_db_query("select configuration_value from configuration where configuration_key=\"PRODUCT_IMAGE_POPUP_WIDTH\"");
					$width_obj = mysql_fetch_object($cur_query);
					$cur_query = xtc_db_query("select configuration_value from configuration where configuration_key=\"PRODUCT_IMAGE_POPUP_HEIGHT\"");
					$height_obj = mysql_fetch_object($cur_query);
					$new_width = 300;
					if ($width_obj->configuration_value>0)
						$new_width = $width_obj->configuration_value;
					$new_height = round ($new_width / $ratio);
					if ($new_height>$height_obj->configuration_value)
					{
						$new_height=$height_obj->configuration_value;
						$new_width = round ($new_height * $ratio);
					}
					
					if ($new_width<$width && $new_height<$height)
					{
						$new_width=$width;
						$new_height=$height;
					}
					$image_p = imagecreatetruecolor($new_width, $new_height);
					imagecopyresampled($image_p, $im, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
					imagejpeg($image_p, DIR_FS_CATALOG_POPUP_IMAGES.$bildname, 80);
					chmod (DIR_FS_CATALOG_POPUP_IMAGES.$bildname, 0644);									
				
					//updaten
					if (intval($_POST['nNr'])==1)
						eS_execute_query("update products set products_image=\"$bildname\" where products_id=".$products_id);
					else 
					{
						//lösche evtl. alten Eintrag
						eS_execute_query("delete from products_images where products_id=$products_id and image_nr=".(intval($_POST['nNr'])-1));
						eS_execute_query("insert into products_images (products_id, image_nr, image_name) values ($products_id, ".(intval($_POST['nNr'])-1).", \"".$bildname."\")");
					}
				}
			}
		}
	}
}
mysql_close();
echo($return);
logge($return);

?>
 

Ähnliche Themen