Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Ask me for details --> Nicolaslagios.com
- foreach ($telikospinakas as $row) {
- if ($row['Parent SKU'] == 0) {
- $imagearray = explode("|", $row['Image URL']);
- $count = 1;
- foreach ($imagearray as $image) {
- // Check if image URL is valid
- if(@getimagesize($image)){
- // Save the image to the "images" folder
- $image_name = $row['SKU'];
- if($count > 1){
- $image_name .= "_" . chr(96 + $count);
- }
- // Get the extension of the original image file
- $path_parts = pathinfo($image);
- $extension = $path_parts['extension'];
- // Save the image with the original extension
- file_put_contents("images/" . $image_name . "." . $extension, file_get_contents($image));
- }
- $count++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement